Re: [PATCH 00/10] btrfs: Support for DAX devices

2018-12-06 Thread Goldwyn Rodrigues
On 11:07 06/12, Johannes Thumshirn wrote: > On 05/12/2018 13:28, Goldwyn Rodrigues wrote: > > This is a support for DAX in btrfs. I understand there have been > > previous attempts at it. However, I wanted to make sure copy-on-write > > (COW) works on dax as well. >

Re: [PATCH 07/10] dax: export functions for use with btrfs

2018-12-06 Thread Goldwyn Rodrigues
On 6:52 05/12, Christoph Hellwig wrote: > If you want to export these at all they have to be EXPORT_SYMBOL_GPL. > Understood. > But I'd really like to avoid seeing another duplicate DAX I/O path. > Please try to adopt the existing iomap-based infrastructure for your > needs first. This is not

[PATCH 10/10] btrfs: dax mmap write

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Create a page size extent and copy the contents of the original extent into the new one, and present to user space as the page to write. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/dax.c | 39 +++ 1 file changed, 39 insertions

[PATCH 06/10] btrfs: dax write support

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is a combination of direct and buffered I/O. Similarties with direct I/O is that it needs to allocate space before writing. Similarities with buffered is when the data is not page-aligned, it needs to copy parts of the previous extents. In order to accomplish

[PATCH 09/10] btrfs: dax support for cow_page/mmap_private and shared

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/dax.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/dax.c b/fs/btrfs/dax.c index 88017f8799d1..6d68d39cc5da 100644 --- a/fs/btrfs/dax.c +++ b/fs/btrfs/dax.c

[PATCH 07/10] dax: export functions for use with btrfs

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues These functions are required for btrfs dax support. Signed-off-by: Goldwyn Rodrigues --- fs/dax.c| 35 --- include/linux/dax.h | 16 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/fs/dax.c b

[PATCH 03/10] btrfs: dax: read zeros from holes

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/dax.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/dax.c b/fs/btrfs/dax.c index d614bf73bf8e..5a297674adec 100644 --- a/fs/btrfs/dax.c +++ b/fs/btrfs/dax.c @@ -54,7 +54,12 @@ ssize_t

[PATCH 00/10] btrfs: Support for DAX devices

2018-12-05 Thread Goldwyn Rodrigues
This is a support for DAX in btrfs. I understand there have been previous attempts at it. However, I wanted to make sure copy-on-write (COW) works on dax as well. Before I present this to the FS folks I wanted to run this through the btrfs. Even though I wish, I cannot get it correct the first

[PATCH 01/10] btrfs: create a mount option for dax

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Also, set the inode->i_flags to S_DAX Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 1 + fs/btrfs/ioctl.c | 5 - fs/btrfs/super.c | 15 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctre

[PATCH 04/10] Rename __endio_write_update_ordered() to btrfs_update_ordered_extent()

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Since we will be using it in another part of the code, use a better name to declare it non-static Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 7 +-- fs/btrfs/inode.c | 14 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git

[PATCH 02/10] btrfs: basic dax read

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/Makefile | 1 + fs/btrfs/ctree.h | 5 fs/btrfs/dax.c| 68 +++ fs/btrfs/file.c | 13 ++- 4 files changed, 86 insertions(+), 1 deletion(-) create mode

[PATCH 08/10] btrfs: dax add read mmap path

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 1 + fs/btrfs/dax.c | 43 +++ fs/btrfs/file.c | 12 +++- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index

[PATCH 05/10] btrfs: Carve out btrfs_get_extent_map_write() out of btrfs_get_blocks_write()

2018-12-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This makes btrfs_get_extent_map_write() independent of Direct I/O code. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/inode.c | 40 +++- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/fs

Re: [PATCH] btrfs: Remove unused variable mode in btrfs_mount

2018-10-08 Thread Goldwyn Rodrigues
On 15:03 08/10, David Sterba wrote: > On Fri, Oct 05, 2018 at 07:26:15AM -0500, Goldwyn Rodrigues wrote: > > Code cleanup. > > Have you check when and why the variable become unused? Thanks. No, I did not check it earlier. git blame points to 312c89fbca06 ("btrfs: cleanup

[PATCH] btrfs: Remove unused variable mode in btrfs_mount

2018-10-05 Thread Goldwyn Rodrigues
Code cleanup. Signed-off-by: Goldwyn Rodrigues diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index e7f702761cb7..f7b8b7a6b86a 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1661,14 +1661,10 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags

Re: [PATCH] btrfs: Use iocb to derive pos instead of passing a separate parameter

2018-06-25 Thread Goldwyn Rodrigues
On 06-25 18:20, David Sterba wrote: > On Mon, Jun 25, 2018 at 01:58:58PM +0900, Misono Tomohiro wrote: > > So, this is the updated version of > > https://patchwork.kernel.org/patch/10063039/ > > > > This time xfstest is ok and > > Reviewed-by: Misono Tomohiro Yes, thats right. > > Your

[PATCH] btrfs: Use iocb to derive pos instead of passing a separate parameter

2018-06-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues struct kiocb carries the ki_pos, so there is no need to pass it as a separate function parameter. generic_file_direct_write() increments ki_pos, so we now assign pos after the function. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/file.c | 15 --- 1 file

Re: [RFC PATCH 0/8] btrfs iomap support

2017-11-17 Thread Goldwyn Rodrigues
On 11/17/2017 12:45 PM, Nikolay Borisov wrote: > > > On 17.11.2017 19:44, Goldwyn Rodrigues wrote: >> This patch series attempts to use kernels iomap for btrfs. Currently, >> it covers buffered writes only, but I intend to add some other iomap >> uses once this

[RFC PATCH 1/8] btrfs: use iocb for __btrfs_buffered_write

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Preparatory patch. It reduces the arguments to __btrfs_buffered_write to follow buffered_write() style. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/btrfs/file.c | 24 1 file changed, 12 inser

[RFC PATCH 7/8] fs: iomap->prepare_pages() to set directives specific for the page

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This adds prepare_pages() to iomap in order to set page directives for the page so as FS such as btrfs may perform post-write operations after write completes. Can we do away with this? EXTENT_PAGE_PRIVATE is only set and not used. However, w

[RFC PATCH 7/8] fs: iomap->prepare_pages() to set directives specific for the page

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This adds prepare_pages() to iomap in order to set page directives for the page so as FS such as btrfs may perform post-write operations after write completes. Can we do away with this? EXTENT_PAGE_PRIVATE is only set and not used. However, w

[RFC PATCH 8/8] iomap: Introduce iomap->dirty_page()

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> In dirty_page(), we are clearing PageChecked, though I don't see it set. Is this used for compression only? Can we call __set_page_dirty_nobuffers instead? Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/btrfs/file.c | 8

[RFC PATCH 3/8] fs: Introduce IOMAP_F_NOBH

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOMAP_F_NOBH tells iomap functions not to use or attach buffer heads to the page. Page flush and writeback is the responsibility of the filesystem (such as btrfs) code, which use bio to perform it. Signed-off-by: Goldwyn Rodrigues <rgold...

[RFC PATCH 5/8] btrfs: use iomap to perform buffered writes

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This eliminates all page related code. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/btrfs/btrfs_inode.h | 4 +- fs/btrfs/file.c| 488 ++--- 2 files changed, 185 insert

[RFC PATCH 6/8] btrfs: read the first/last page of the write

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> We cannot perform a readpage in iomap_apply after iomap_begin() because we have our extents locked. So, we perform a readpage and make sure we unlock it, but increase the page count. Question: How do we deal with -EAGAIN retur

[RFC PATCH 8/8] fs: Introduce iomap->dirty_page()

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> In dirty_page(), we are clearing PageChecked, though I don't see it set. Is this used for compression only? Can we call __set_page_dirty_nobuffers instead? Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/btrfs/file.c | 8

[RFC PATCH 4/8] btrfs: Introduce btrfs_iomap

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Preparatory patch. btrfs_iomap structure carries extent/page state from iomap_begin() to iomap_end(). Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/btrfs/file.c | 68 ++

[RFC PATCH 2/8] fs: Add inode_extend_page()

2017-11-17 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This splits the generic_write_end() into functions which handle block_write_end() and iomap_extend_page(). iomap_extend_page() performs the functions of increasing i_size (if required) and extending pagecache. Performed this split so we don

[RFC PATCH 0/8] btrfs iomap support

2017-11-17 Thread Goldwyn Rodrigues
This patch series attempts to use kernels iomap for btrfs. Currently, it covers buffered writes only, but I intend to add some other iomap uses once this gets through. I am sending this as an RFC because I would like to find ways to improve the solution since some changes require adding more

Re: What is the purpose of EXTENT_PAGE_MAPPED

2017-10-30 Thread Goldwyn Rodrigues
On 10/30/2017 09:01 AM, Nikolay Borisov wrote: > > > On 30.10.2017 15:55, David Sterba wrote: >> On Mon, Oct 30, 2017 at 03:21:51PM +0200, Nikolay Borisov wrote: >>> >>> >>> On 27.10.2017 07:17, Liu Bo wrote: >>>> On Tue, Oct

What is the purpose of EXTENT_PAGE_MAPPED

2017-10-24 Thread Goldwyn Rodrigues
EXTENT_PAGE_MAPPED gets set in set_page_extent_mapped(), but I don't see it being cross checked anytime. What is the purpose of setting it? -- Goldwyn -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo

[PATCH v2] btrfs: cleanup extent locking sequence

2017-10-16 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Code cleanup for better understanding: Variable needs_unlock to be called extent_locked to show state as opposed to action. Changed the type to int, to reduce code in the critical path. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com>

[PATCH] Remove unused dedupe argument btrfs_set_extent_delalloc()

2017-10-10 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/btrfs/ctree.h | 2 +- fs/btrfs/file.c | 2 +- fs/btrfs/inode.c | 9 - fs/btrfs/relocation.c| 2 +- fs/btrfs/tests/inode-

[PATCH] btrfs: cleanup extent locking sequence

2017-10-10 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Code cleanup for better understanding: needs_unlock to be called extent_locked to show state as opposed to action. Changed the variable to int, to reduce code in the critical path(code usually executed). Signed-off-by: Goldwyn Rodrigues

Re: Commit edf064e7c (btrfs: nowait aio support) breaks shells

2017-07-07 Thread Goldwyn Rodrigues
On 07/04/2017 05:16 PM, Jens Axboe wrote: > > Please expedite getting this upstream, asap. > Jens, I have posted an updated patch [1] and it is acked by David. Would you pick it up or should it go through the btrfs tree (or some other tree)? [1] https://patchwork.kernel.org/patch/9825813/

[PATCH v2] btrfs: Correct assignment of pos

2017-07-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Assigning pos for usage early messes up in append mode, where the pos is re-assigned in generic_write_checks(). Assign pos later to get the correct position to write from iocb->ki_pos. Since check_can_nocow also uses the value of pos,

[PATCH] btrfs: Correct assignment of pos

2017-07-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Assigning pos for usage early messes up in append mode, where the pos is re-assigned in generic_write_checks(). Re-assign pos to get the correct position to write from iocb->ki_pos. Fixes: edf064e7c6fe ("btrfs: nowait aio suppor

Re: Commit edf064e7c (btrfs: nowait aio support) breaks shells

2017-07-04 Thread Goldwyn Rodrigues
On 07/04/2017 02:45 AM, Markus Trippelsdorf wrote: > On 2017.07.04 at 06:23 +0200, Markus Trippelsdorf wrote: >> commit edf064e7c6fec3646b06c944a8e35d1a3de5c2c3 (HEAD, refs/bisect/bad) >> Author: Goldwyn Rodrigues <rgold...@suse.com> >> Date: Tue Jun 20 07:05:49

Re: [PATCH 0/10 v11] No wait AIO

2017-06-12 Thread Goldwyn Rodrigues
On 06/10/2017 12:34 AM, Al Viro wrote: > On Thu, Jun 08, 2017 at 12:39:10AM -0700, Christoph Hellwig wrote: >> As already indicated this whole series looks fine to me. >> >> Al: are you going to pick this up? Or Andrew? > > The main issue here is "let's bail out from ->write_iter() instances"

[PATCH 02/10] fs: Introduce filemap_range_has_page()

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> filemap_range_has_page() return true if the file's mapping has a page within the range mentioned. This function will be used to check if a write() call will cause a writeback of previous writes. Reviewed-by: Christoph Hellwig <h...@lst.de&

[PATCH 03/10] fs: Use RWF_* flags for AIO operations

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry the RWF_* flags. We cannot use aio_flags because they are not checked for validity which may break existing applications. Note, the only place RWF_HIPRI comes in

[PATCH 05/10] fs: return if direct write will trigger writeback

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. Return -EINVAL for buffered AIO: there are multiple causes of delay such as page locks, dirty throttling logic, page loading from disk etc. which cannot be take

[PATCH 04/10] fs: Introduce RWF_NOWAIT

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_NOWAIT informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. RWF_NOWAIT is translated to IOCB_NOWAIT fo

[PATCH 07/10] block: return on congested block device

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (th

[PATCH 10/10] btrfs: nowait aio support

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Acked-by: David Sterba <dste...

[PATCH 01/10] fs: Separate out kiocb flags setup based on RWF_* flags

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> Reviewed-by: Jan Kara <j...@suse.cz> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/read_write.c| 12 +++- include/linux/fs.h | 14 ++ 2 file

[PATCH 06/10] fs: Introduce IOMAP_NOWAIT

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Reviewed-by: Christoph Hellwig <h...@lst.de> Reviewed-by: Jan Kara <j...@suse.cz> Signed-off-by: Goldwyn Rodrigues <rgold...@suse

[PATCH 09/10] xfs: nowait aio support

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 08/10] ext4: nowait aio support

2017-06-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 0/10 v11] No wait AIO

2017-06-06 Thread Goldwyn Rodrigues
This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block device The goal of the patch series is to

Re: [RFC PATCH] btrfs: qgroup: Fix hang when using inode_cache and qgroup

2017-06-05 Thread Goldwyn Rodrigues
deadlock. > > Now for space cache inode, we will not allow qgroup retry, so it will > not cause deadlock. > > Fixes: 48a89bc4f2ce ("btrfs: qgroups: Retry after commit on getting EDQUOT") > Cc: Goldwyn Rodrigues <rgold...@suse.de> > Signed-off-by: Qu Wenruo <quwe

[PATCH 01/10] fs: Separate out kiocb flags setup based on RWF_* flags

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> Reviewed-by: Jan Kara <j...@suse.cz> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> --- fs/read_write.c| 12 +++- include/linux/fs.h | 14 ++ 2 file

[PATCH 02/10] fs: Introduce filemap_range_has_page()

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> filemap_range_has_page() return true if the file's mapping has a page within the range mentioned. This function will be used to check if a write() call will cause a writeback of previous writes. Reviewed-by: Christoph Hellwig <h...@lst.de&

[PATCH 06/10] fs: Introduce IOMAP_NOWAIT

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Reviewed-by: Christoph Hellwig <h...@lst.de> Reviewed-by: Jan Kara <j...@suse.cz> Signed-off-by: Goldwyn Rodrigues <rgold...@suse

[PATCH 09/10] xfs: nowait aio support

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 08/10] ext4: nowait aio support

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 10/10] btrfs: nowait aio support

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Acked-by: David Sterba <dste...

[PATCH 03/10] fs: Use RWF_* flags for AIO operations

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry the RWF_* flags. We cannot use aio_flags because they are not checked for validity which may break existing applications. Note, the only place RWF_HIPRI comes in

[PATCH 05/10] fs: return if direct write will trigger writeback

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. Return -EINVAL for buffered AIO: there are multiple causes of delay such as page locks, dirty throttling logic, page loading from disk etc. which cannot be take

[PATCH 04/10] fs: Introduce RWF_NOWAIT

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_NOWAIT informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. RWF_NOWAIT is translated to IOCB_NOWAIT fo

[PATCH 07/10] fs: return on congested block device

2017-06-04 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (th

[PATCH 0/10 v10] No wait AIO

2017-06-04 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

Re: [PATCH 09/10] xfs: nowait aio support

2017-05-30 Thread Goldwyn Rodrigues
On 05/29/2017 03:33 AM, Christoph Hellwig wrote: > On Sun, May 28, 2017 at 09:38:26PM -0500, Goldwyn Rodrigues wrote: >> >> >> On 05/28/2017 04:31 AM, Christoph Hellwig wrote: >>> Despite my previous reviewed-by tag this will need another fix: >>> >>

Re: [PATCH 0/10 v9] No wait AIO

2017-05-28 Thread Goldwyn Rodrigues
On 05/28/2017 04:27 AM, Christoph Hellwig wrote: >> Changes since v8: >> + Err out AIO reads with -EINVAL flagged as RWF_NOWAIT > > Ugg, why? Reads aren't really treated any different than writes in > the direct I/O code. This effort focused on writes only. >From the point of view of the

Re: [PATCH 09/10] xfs: nowait aio support

2017-05-28 Thread Goldwyn Rodrigues
On 05/28/2017 04:31 AM, Christoph Hellwig wrote: > Despite my previous reviewed-by tag this will need another fix: > > xfs_file_iomap_begin needs to return EAGAIN if we don't have the extent > list in memoery already. E.g. something like this: > > if ((flags & IOMAP_NOWAIT) &&

[PATCH 03/10] fs: Use RWF_* flags for AIO operations

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry the RWF_* flags. We cannot use aio_flags because they are not checked for validity which may break existing applications. Note, the only place RWF_HIPRI comes in

[PATCH 01/10] fs: Separate out kiocb flags setup based on RWF_* flags

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/read_write.c| 12 +++- include/linux/fs.h | 14 ++ 2 files changed, 17 insertions(+), 9 deletions(-

[PATCH 05/10] fs: return if direct write will trigger writeback

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. Return -EINVAL for buffered AIO: there are multiple causes of delay such as page locks, dirty throttling logic, page loading from disk etc. which cannot be take

[PATCH 07/10] fs: return on congested block device

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (th

[PATCH 09/10] xfs: nowait aio support

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 08/10] ext4: nowait aio support

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 04/10] fs: Introduce RWF_NOWAIT

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_NOWAIT informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. RWF_NOWAIT is translated to IOCB_NOWAIT fo

[PATCH 06/10] fs: Introduce IOMAP_NOWAIT

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/iomap.c| 2 ++ include/linu

[PATCH 10/10] btrfs: nowait aio support

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 02/10] fs: Introduce filemap_range_has_page()

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> filemap_range_has_page() return true if the file's mapping has a page within the range mentioned. This function will be used to check if a write() call will cause a writeback of previous writes. Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 0/10 v9] No wait AIO

2017-05-24 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 04/10] fs: Introduce RWF_NOWAIT

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_NOWAIT informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. RWF_NOWAIT is translated to IOCB_NOWAIT fo

[PATCH 05/10] fs: return if direct write will trigger writeback

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. Return -EINVAL for buffered AIO: there are multiple causes of delay such as page locks, dirty throttling logic, page loading from disk etc. which cannot be take

[PATCH 06/10] fs: Introduce IOMAP_NOWAIT

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/iomap.c| 2 ++ include/linu

[PATCH 09/10] xfs: nowait aio support

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 08/10] ext4: nowait aio support

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 07/10] fs: return on congested block device

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (th

[PATCH 02/10] fs: Introduce filemap_range_has_page()

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> filemap_range_has_page() return true if the file's mapping has a page within the range mentioned. This function will be used to check if a write() call will cause a writeback of previous writes. Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 10/10] btrfs: nowait aio support

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 03/10] fs: Use RWF_* flags for AIO operations

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry the RWF_* flags. We cannot use aio_flags because they are not checked for validity which may break existing applications. Note, the only place RWF_HIPRI comes in

[PATCH 0/10 v8] No wait AIO

2017-05-11 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 01/10] fs: Separate out kiocb flags setup based on RWF_* flags

2017-05-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/read_write.c| 12 +++- include/linux/fs.h | 14 ++ 2 files changed, 17 insertions(+), 9 deletions(-

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-05-11 Thread Goldwyn Rodrigues
On 05/11/2017 02:44 AM, Christoph Hellwig wrote: > Looks fine, > > Reviewed-by: Christoph Hellwig > > Although lifting the make_request limit is something a lot of users > would appreciate in the near future.. > Yes, I understand. That will be on my todo list next on priority.

qgroup: direct writes returns -EDQUOT too soon

2017-05-10 Thread Goldwyn Rodrigues
Here is a sample script to recreate the issue: mkfs.btrfs -f /dev/vdb mount /dev/vdb /mnt btrfs quota enable /mnt btrfs sub create /mnt/tmp btrfs qgroup limit 200M /mnt/tmp btrfs quota rescan -w /mnt cd /mnt/tmp for i in {1..5}; do sync dd if=/dev/zero of=/mnt/tmp/file-$i

Re: [RFC PATCH v3 5/6] btrfs: qgroup: Introduce extent changeset for qgroup reserve functions

2017-05-10 Thread Goldwyn Rodrigues
On 05/09/2017 09:36 PM, Qu Wenruo wrote: > Introduce a new parameter, struct extent_changeset for > btrfs_qgroup_reserved_data() and its callers. > > Such extent_changeset was used in btrfs_qgroup_reserve_data() to record > which range it reserved in current reserve, so it can free it at error

[PATCH 0/8 v7] No wait AIO

2017-05-09 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 3/8] nowait aio: return if direct write will trigger writeback

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Find out if the write will trigger a wait due to writeback. If yes, return -EAGAIN. This introduces a new function filemap_range_has_page() which returns true if the file's mapping has a page within the range mentioned. Return -EINVAL for buffer

[PATCH 2/8] nowait aio: Introduce RWF_NOWAIT

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> This flag informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. Unfortunately, aio_flags is not checked for va

[PATCH 7/8] nowait aio: xfs

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to

[PATCH 8/8] nowait aio: btrfs

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 5/8] nowait aio: return on congested block device

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (th

[PATCH 6/8] nowait aio: ext4

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues <rgold...

[PATCH 1/8] Use RWF_* flags for AIO operations

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> RWF_* flags is used for preadv2/pwritev2 calls. Port to use it for aio operations as well. For this, aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry these flags. This is a precursor to the nowait AIO calls.

[PATCH 4/8] nowait-aio: Introduce IOMAP_NOWAIT

2017-05-09 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues <rgold...@suse.com> IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com> Reviewed-by: Christoph Hellwig <h...@lst.de> --- fs/iomap.c| 2 ++ include/linu

Re: [PATCH 5/8] nowait aio: return on congested block device

2017-04-24 Thread Goldwyn Rodrigues
On 04/19/2017 01:45 AM, Christoph Hellwig wrote: > On Fri, Apr 14, 2017 at 07:02:54AM -0500, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues <rgold...@suse.com> >> > >> +/* Request queue supports BIO_NOWAIT */ >> +queue_flag_set_unlocked(QU

  1   2   3   >