Re: btrfs: relocation: Fix leaking qgroups numbers on data extents

2016-07-29 Thread Goldwyn Rodrigues
p can get correct result. > > And thanks to the new qgroup framework, we don't need to check whether > it is needed to dirty some file extents. Even some unrelated extents are > re-dirtied, qgroup can handle it quite well. > > So we only need to ensure we don't miss some e

Re: btrfs: relocation: Fix leaking qgroups numbers on data extents

2016-07-30 Thread Goldwyn Rodrigues
On 07/29/2016 08:06 PM, Qu Wenruo wrote: > Hi, Goldwyn, > > This patch is replaced by the following patchset: > https://patchwork.kernel.org/patch/9213915/ > https://patchwork.kernel.org/patch/9213913/ > > Would you mind testing the new patch? > Sorry, it fails. Actually, the previous patch

Re: [PATCH v2 1/3] btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()

2016-08-06 Thread Goldwyn Rodrigues
Thanks Qu, This patch set fixes all the reported problems. However, I have some minor issues with coding style. On 08/04/2016 09:29 PM, Qu Wenruo wrote: > Refactor btrfs_qgroup_insert_dirty_extent() function, to two functions: > 1. _btrfs_qgroup_insert_dirty_extent() >Almost the same with or

Re: [PATCH v2 1/3] btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()

2016-08-06 Thread Goldwyn Rodrigues
Thanks Qu, This patch set fixes all the reported problems. However, I have some minor issues with coding style. On 08/04/2016 09:29 PM, Qu Wenruo wrote: > Refactor btrfs_qgroup_insert_dirty_extent() function, to two functions: > 1. _btrfs_qgroup_insert_dirty_extent() >Almost the same with or

Re: [PATCH v2 1/3] btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()

2016-08-07 Thread Goldwyn Rodrigues
On 08/07/2016 07:39 PM, Qu Wenruo wrote: > > > At 08/07/2016 01:19 AM, Goldwyn Rodrigues wrote: >> Thanks Qu, >> >> This patch set fixes all the reported problems. However, I have some >> minor issues with coding style. >> > > Thanks for the tes

Re: [PATCH v2 1/3] btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()

2016-08-08 Thread Goldwyn Rodrigues
On 08/08/2016 07:26 PM, Qu Wenruo wrote: > > > At 08/08/2016 10:54 AM, Goldwyn Rodrigues wrote: >> >> >> On 08/07/2016 07:39 PM, Qu Wenruo wrote: >>> >>> >>> At 08/07/2016 01:19 AM, Goldwyn Rodrigues wrote: >>>> Thanks Qu, &g

Re: [PATCH v2 1/3] btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()

2016-08-08 Thread Goldwyn Rodrigues
On 08/08/2016 08:12 PM, Qu Wenruo wrote: > > > At 08/09/2016 09:01 AM, Goldwyn Rodrigues wrote: >> >> >> On 08/08/2016 07:26 PM, Qu Wenruo wrote: >>> >>> >>> At 08/08/2016 10:54 AM, Goldwyn Rodrigues wrote: >>>> >>>>

Re: [PATCH v3 2/3] btrfs: relocation: Fix leaking qgroups numbers on data extents

2016-08-09 Thread Goldwyn Rodrigues
ount these data extents correctly. > > Cc: Mark Fasheh > Reported-by: Mark Fasheh > Reported-by: Filipe Manana > Signed-off-by: Qu Wenruo Tested-by: Goldwyn Rodrigues > --- > fs/btrfs/relocation.c | 114 > +++--- > 1 f

Re: [PATCH v3 1/3] btrfs: qgroup: Refactor btrfs_qgroup_insert_dirty_extent()

2016-08-09 Thread Goldwyn Rodrigues
d comment for both functions, to info developers how to keep > qgroup correct when doing hacks. > > Cc: Mark Fasheh > Cc: Goldwyn Rodrigues > Signed-off-by: Qu Wenruo Reviewed-and-Tested-by: Goldwyn Rodrigues > --- > fs/btrfs/delayed-ref.c | 7 ++- > fs/btrfs/ext

Re: [PATCH v3 3/3] btrfs: qgroup: Fix qgroup incorrectness caused by log replay

2016-08-09 Thread Goldwyn Rodrigues
ug can be detected by btrfs/119 test case. > > Cc: Mark Fasheh > Signed-off-by: Qu Wenruo Reviewed-and-Tested-by: Goldwyn Rodrigues > --- > fs/btrfs/tree-log.c | 16 > 1 file changed, 16 insertions(+) > > diff --git a/fs/btrfs/tree-log.c b/fs/btr

[PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-22 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While free'ing qgroup->reserved resources, we must check if the page is already commmitted to disk or still in memory. If not, the reserve free is doubly accounted, once while invalidating the page, and the next time while free'ing delalloc. This resu

[PATCH] parent_start initialization cleanup

2016-09-22 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Code cleanup. parent_start is initialized multiple times when it is not necessary to do so. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c

[PATCH] Do not reassign count in btrfs_run_delayed_refs

2016-09-22 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Code cleanup. count is already (unsgined long)-1. That is the reason run_all was set. Do not reassign it (unsigned long)-1. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/extent-tree.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs

[PATCH] Remove already completed TODO comment

2016-09-22 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Fixes: 7cf5b97650f2 ("btrfs: qgroup: Cleanup old inaccurate facilities") Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/extent-tree.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 23b3b9f..a8a4931 10

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-23 Thread Goldwyn Rodrigues
On 09/22/2016 08:06 PM, Qu Wenruo wrote: > > > At 09/23/2016 02:47 AM, Goldwyn Rodrigues wrote: >> From: Goldwyn Rodrigues >> >> While free'ing qgroup->reserved resources, we must check >> if the page is already commmitted to disk or still in memo

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-26 Thread Goldwyn Rodrigues
On 09/25/2016 09:33 PM, Qu Wenruo wrote: > > > At 09/23/2016 09:43 PM, Goldwyn Rodrigues wrote: >> >> >> On 09/22/2016 08:06 PM, Qu Wenruo wrote: >>> >>> >>> At 09/23/2016 02:47 AM, Goldwyn Rodrigues wrote: >>>> From: Goldwyn

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-27 Thread Goldwyn Rodrigues
On 09/26/2016 10:10 PM, Qu Wenruo wrote: > > > At 09/26/2016 10:31 PM, Goldwyn Rodrigues wrote: >> >> >> On 09/25/2016 09:33 PM, Qu Wenruo wrote: >>> >>> >>> At 09/23/2016 09:43 PM, Goldwyn Rodrigues wrote: >>>> >>>&g

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-27 Thread Goldwyn Rodrigues
On 09/27/2016 08:44 PM, Qu Wenruo wrote: > Finally reproduced it. > > Although in a low chance, about 1/10. > > Under most case, the final remove gets executed without error. Change 50m to 500m while setting the qgroup limit, the probability will increase. -- Goldwyn -- To unsubscribe fro

Re: [PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-29 Thread Goldwyn Rodrigues
On 09/29/2016 03:57 AM, Qu Wenruo wrote: > Thanks for your test script. > > I succeeded in pinning down the problem. > > The problem is, btrfs is invalidate pages that belongs to ordered > extent(goes through writeback) No, I don't think invalidated pages are going through writeback. The prob

[PATCH] qgroup: Prevent qgroup->reserved from going subzero

2016-09-30 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While free'ing qgroup->reserved resources, we much check if the page has not been invalidated by a truncate operation by checking if the page is still dirty before reducing the qgroup resources. Resources in such a case are free'd when the entire extent i

Re: [PATCH 1/2] btrfs: Add WARN_ON for qgroup reserved underflow

2016-09-30 Thread Goldwyn Rodrigues
good. Reviewed-by: Goldwyn Rodrigues > --- > fs/btrfs/qgroup.c | 21 - > 1 file changed, 16 insertions(+), 5 deletions(-) > > diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c > index 8db2e29..8532587 100644 > --- a/fs/btrfs/qgroup.c > +++ b/

Re: [PATCH 2/2] btrfs: Add trace point for qgroup reserved space

2016-09-30 Thread Goldwyn Rodrigues
t. > > Signed-off-by: Qu Wenruo Reviewed-by: Goldwyn Rodrigues > --- > fs/btrfs/qgroup.c| 21 ++--- > fs/btrfs/qgroup.h| 2 +- > include/trace/events/btrfs.h | 43 +++ > 3 files changed,

Re: [PATCH v3.1 2/3] btrfs: relocation: Fix leaking qgroups numbers on data extents

2016-10-04 Thread Goldwyn Rodrigues
reloc tree. > Since at commit transaction time, the tree swapping is done, and qgroup > will account these data extents correctly. > > Cc: Mark Fasheh > Reported-by: Mark Fasheh > Reported-by: Filipe Manana > Signed-off-by: Qu Wenruo > Tested-by: Goldwyn Rodrigues >

Re: [PATCH] btrfs: relocation: Fix NULL pointer access and leaking qgroups in btrfs_recover_relocation

2016-10-06 Thread Goldwyn Rodrigues
cp -a /boot $S; done; #let the cp from above finish wait btrfs fi sync $MNT btrfs quota enable $MNT btrfs quota rescan -w $MNT btrfs qg show $MNT umount $MNT mount -t btrfs $DEV $MNT time btrfs balance start --full-balance $MNT umount $MNT btrfsck $DEV > > Reported-by: Goldwyn R

Re: [PATCH] btrfs: relocation: Fix NULL pointer access and leaking qgroups in btrfs_recover_relocation

2016-10-07 Thread Goldwyn Rodrigues
On 10/06/2016 09:32 PM, Qu Wenruo wrote: > > > At 10/07/2016 02:00 AM, Goldwyn Rodrigues wrote: >> Hi Qu, >> >> On 10/06/2016 03:03 AM, Qu Wenruo wrote: >>> We fixed balance qgroup leaking by introducing >>> qgroup_fix_relocated_data_extents(),

[PATCH] btrfs-progs: Initialize btrfs_path before use

2016-10-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While performing an fsck, an assertion failure occurs because of reusing path in a loop. ctree.c:1112: btrfs_search_slot: Warning: assertion `p->nodes[0] != NULL` failed, value 0 Signed-off-by: Goldwyn Rodrigues diff --git a/cmds-check.c b/cmds-check.c index 670c

[PATCH] Release path after usage.

2016-10-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While performing an fsck, an assertion failure occurs because of reusing path in a loop. ctree.c:1112: btrfs_search_slot: Warning: assertion `p->nodes[0] != NULL` failed, value 0 Signed-off-by: Goldwyn Rodrigues diff --git a/cmds-check.c b/cmds-check.c index 670c

Re: [PATCH] btrfs-progs: Initialize btrfs_path before use

2016-10-24 Thread Goldwyn Rodrigues
On 10/24/2016 09:57 AM, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > While performing an fsck, an assertion failure occurs because of reusing path > in a loop. > ctree.c:1112: btrfs_search_slot: Warning: assertion `p->nodes[0] != NULL` > failed, value 0 >

[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 a

[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

[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 tim

[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 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 that

[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

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

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. > > &

[PATCH] btrfs: Simplify update space_info in __reserve_metadata_bytes()

2019-06-19 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Simplification. We don't need an if-else-if structure where we can use a simple OR since both conditions are performing the same action. The short-circuit for OR will ensure that if the first condition is true, can_overcommit() is not called. Signed-off-by: Go

[PATCH] btrfs: Evaluate io_tree in find_lock_delalloc_range()

2019-06-21 Thread Goldwyn Rodrigues
Simplification. No point passing the tree variable when it can be evaluated from inode. The tests now use the io_tree from btrfs_inode as opposed to creating one. Changes since v1: - included btrfs sanity tests Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/extent_io.c | 6

[PATCH 1/6] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-06-21 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Introduces a new type IOMAP_COW, which means the data at offset must be read from a srcmap and copied before performing the write on the offset. The srcmap is used to identify where the read is to be performed from. This is passed to iomap->begin(), which is supposed

[PATCH 3/6] iomap: Check iblocksize before transforming page->private

2019-06-21 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs uses page->private as well to store extent_buffer. Make the check stricter to make sure we are using page->private for iop by comparing iblocksize < PAGE_SIZE. Signed-off-by: Goldwyn Rodrigues --- include/linux/iomap.h | 3 ++- 1 file changed, 2 inserti

[PATCH 5/6] btrfs: Add CoW in iomap based writes

2019-06-21 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Set iomap->type to IOMAP_COW and fill up the source map in case the I/O is not page aligned. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/iomap.c | 41 + 1 file changed, 41 insertions(+) diff --git a/fs/btrfs/iomap.c b/fs/bt

[PATCH 4/6] btrfs: Add a simple buffered iomap write

2019-06-21 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Introduce a new static structure btrfs_iomap, which carries information from iomap_begin() to iomap_end(). This primarily contains reservation and extent locking information. This one is a long patch. Most of the code is "inspired" by fs/btrfs/file.c. To kee

[PATCH 2/6] iomap: Read page from srcmap for IOMAP_COW

2019-06-21 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/iomap.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/iomap.c b/fs/iomap.c index 6648957af268..8a7b20e432ef 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -655,7 +655,7 @@ __iomap_write_begin

[PATCH 0/6] Btrfs iomap

2019-06-21 Thread Goldwyn Rodrigues
This is an effort to use iomap with btrfs. This would keep most responsibility of page handling during writes in iomap code, hence code reduction. For CoW support, changes are needed in iomap code to make sure we perform a copy before the write. This is in line with the discussion we had during add

[PATCH 6/6] btrfs: remove buffered write code made unnecessary

2019-06-21 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Better done in a separate patch to keep the main patch short(er) Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/file.c | 464 1 file changed, 464 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index

Re: [PATCH 3/6] iomap: Check iblocksize before transforming page->private

2019-06-25 Thread Goldwyn Rodrigues
On 9:05 24/06, Christoph Hellwig wrote: > On Fri, Jun 21, 2019 at 02:28:25PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > btrfs uses page->private as well to store extent_buffer. Make > > the check stricter to make sure we are using page->

Re: [PATCH 1/6] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-06-25 Thread Goldwyn Rodrigues
On 9:07 24/06, Christoph Hellwig wrote: > xfs will need to be updated to fill in the additional iomap for the > COW case. Has this series been tested on xfs? > No, I have not tested this, or make xfs set IOMAP_COW. I will try to do it in the next iteration. > I can't say I'm a huge fan of this

Re: [PATCH 1/6] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-06-25 Thread Goldwyn Rodrigues
On 17:46 21/06, Darrick J. Wong wrote: > On Fri, Jun 21, 2019 at 02:28:23PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > Introduces a new type IOMAP_COW, which means the data at offset > > must be read from a srcmap and copied before performing

Re: [PATCH 3/6] iomap: Check iblocksize before transforming page->private

2019-06-25 Thread Goldwyn Rodrigues
On 17:21 21/06, Darrick J. Wong wrote: > On Fri, Jun 21, 2019 at 02:28:25PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > btrfs uses page->private as well to store extent_buffer. Make > > the check stricter to make sure we are using page->

Re: [PATCH 3/6] iomap: Check iblocksize before transforming page->private

2019-06-25 Thread Goldwyn Rodrigues
On 21:04 25/06, Filipe Manana wrote: > On Tue, Jun 25, 2019 at 8:58 PM Goldwyn Rodrigues wrote: > > > > On 9:05 24/06, Christoph Hellwig wrote: > > > On Fri, Jun 21, 2019 at 02:28:25PM -0500, Goldwyn Rodrigues wrote: > > > > From: Goldwyn Rodrigues > &g

Re: [PATCH 1/6] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-06-26 Thread Goldwyn Rodrigues
On 8:39 26/06, Christoph Hellwig wrote: > On Tue, Jun 25, 2019 at 02:14:42PM -0500, Goldwyn Rodrigues wrote: > > > I can't say I'm a huge fan of this two iomaps in one method call > > > approach. I always though two separate iomap iterations would be nicer, >

Re: [PATCH 1/6] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-06-26 Thread Goldwyn Rodrigues
On 11:00 26/06, Darrick J. Wong wrote: > On Tue, Jun 25, 2019 at 02:14:42PM -0500, Goldwyn Rodrigues wrote: > > On 9:07 24/06, Christoph Hellwig wrote: > > > xfs will need to be updated to fill in the additional iomap for the > > > COW case. Has this series been tested

[PATCH v2 0/13] Btrfs iomap

2019-08-02 Thread Goldwyn Rodrigues
This is an effort to use iomap for btrfs. This would keep most responsibility of page handling during writes in iomap code, hence code reduction. For CoW support, changes are needed in iomap code to make sure we perform a copy before the write. This is in line with the discussion we had during addi

[PATCH 02/13] iomap: Read page from srcmap for IOMAP_COW

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues In case of a IOMAP_COW, read a page from the srcmap before performing a write on the page. Signed-off-by: Goldwyn Rodrigues --- fs/iomap/buffered-io.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap

[PATCH 01/13] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Introduces a new type IOMAP_COW, which means the data at offset must be read from a srcmap and copied before performing the write on the offset. The srcmap is used to identify where the read is to be performed from. This is passed to iomap->begin() of the respect

[PATCH 03/13] btrfs: Eliminate PagePrivate for btrfs data pages

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While most of the code works just eliminating page's private field and related code, there is a problem when we are cloning. The extent assumes the data is uptodate. Clear the EXTENT_UPTODATE flag for the extent so the next time the file is read, it is forced to be

[PATCH 08/13] btrfs: Carve out btrfs_get_extent_map_write() out of btrfs_get_blocks_write()

2019-08-02 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

[PATCH 11/13] btrfs: Use iomap_dio_rw for performing direct I/O writes

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Since btrfs Direct I/O needs to perform operations before submission, use the submit_io function which operates on the bio to perform checksum calculations etc. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 3 ++ fs/btrfs/file.c | 2 +- fs/btrfs/inode.c

[PATCH 04/13] btrfs: Add a simple buffered iomap write

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Introduce a new btrfs_iomap structure which contains information about the filesystem between the iomap_begin() and iomap_end() calls. This contains information about reservations and extent locking. This one is a long patch. Most of the code is "inspired" b

[PATCH 09/13] btrfs: Rename __endio_write_update_ordered() to btrfs_update_ordered_extent()

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Since we will be calling from another file, 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 a/fs/btrfs

[PATCH 13/13] btrfs: update inode size during bio completion

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Update the inode size for dio writes during bio completion. This ties the success of the underlying block layer whether to increase the size of the inode. Especially for in aio cases. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 6 +- 1 file changed, 5

[PATCH 10/13] iomap: use a function pointer for dio submits

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This helps filesystems to perform tasks on the bio while submitting for I/O. Since btrfs requires the position we are working on, pass pos to iomap_dio_submit_bio() The correct place for submit_io() is not page_ops. Would it better to rename the structure to something

[PATCH 06/13] btrfs: remove buffered write code made unnecessary

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Better done in a separate patch to keep the main patch short(er) Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/file.c | 463 1 file changed, 463 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index

[PATCH 05/13] btrfs: Add CoW in iomap based writes

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Set iomap->type to IOMAP_COW and fill up the source map in case the I/O is not page aligned. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/iomap.c | 41 + 1 file changed, 41 insertions(+) diff --git a/fs/btrfs/iomap.c b/fs/bt

[PATCH 07/13] btrfs: basic direct read operation

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Add btrfs_dio_iomap_ops for iomap.begin() function. In order to accomodate dio reads, add a new function btrfs_file_read_iter() which would call btrfs_dio_iomap_read() for DIO reads and fallback to generic_file_read_iter otherwise. Signed-off-by: Goldwyn Rodrigues

[PATCH 12/13] btrfs: Remove btrfs_dio_data and __btrfs_direct_write

2019-08-02 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_dio_data is unnecessary since we are now storing all informaiton in btrfs_iomap. Advantage: We don't abuse current->journal_info anymore :) Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/file.c | 40 fs/btrfs/inod

Re: [PATCH 10/13] iomap: use a function pointer for dio submits

2019-08-05 Thread Goldwyn Rodrigues
On Mon, 2019-08-05 at 09:43 +1000, Dave Chinner wrote: > On Fri, Aug 02, 2019 at 05:00:45PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > This helps filesystems to perform tasks on the bio while > > submitting for I/O. Since btrfs requires the pos

Re: [PATCH 10/13] iomap: use a function pointer for dio submits

2019-08-05 Thread Goldwyn Rodrigues
On Fri, 2019-08-02 at 17:21 -0700, Darrick J. Wong wrote: > On Fri, Aug 02, 2019 at 05:00:45PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > This helps filesystems to perform tasks on the bio while > > submitting for I/O. Since btrfs requi

Re: [PATCH 07/13] btrfs: basic direct read operation

2019-08-22 Thread Goldwyn Rodrigues
On 18:02 12/08, RITESH HARJANI wrote: > > On 8/3/19 3:30 AM, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > Add btrfs_dio_iomap_ops for iomap.begin() function. In order to > > accomodate dio reads, add a new function btrfs_file_read_iter() > > w

Re: [PATCH 05/13] btrfs: Add CoW in iomap based writes

2019-08-22 Thread Goldwyn Rodrigues
On 10:13 05/08, Dave Chinner wrote: > On Fri, Aug 02, 2019 at 05:00:40PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > Set iomap->type to IOMAP_COW and fill up the source map in case > > the I/O is not page aligned. > . > > stat

Re: [PATCH 04/13] btrfs: Add a simple buffered iomap write

2019-08-22 Thread Goldwyn Rodrigues
On 10:11 05/08, Dave Chinner wrote: > On Fri, Aug 02, 2019 at 05:00:39PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > Introduce a new btrfs_iomap structure which contains information > > about the filesystem between the iomap_begin() and

[PATCH 02/15] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Introduces a new type IOMAP_COW, which means the data at offset must be read from a srcmap and copied before performing the write on the offset. The srcmap is used to identify where the read is to be performed from. This is passed to iomap->begin() of the respect

[PATCH 03/15] iomap: Read page from srcmap for IOMAP_COW

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues In case of a IOMAP_COW, read a page from the srcmap before performing a write on the page. Signed-off-by: Goldwyn Rodrigues Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff

[PATCH 05/15] btrfs: Add a simple buffered iomap write

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This one is a long patch. Most of the code is "inspired" by fs/btrfs/file.c. To keep the size small, all removals are in following patches. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/Kconfig | 1 + fs/btrfs/Makefile | 2 +- fs/btrfs/ctree.h | 1 +

[PATCH 13/15] btrfs: Use iomap_dio_rw for performing direct I/O writes

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_iomap_init() is a function to be used to btrfs_iomap structure which is used to pass information between iomap begin() and end(). All data reservations and allocations must be performed in this function. For reads, btrfs_iomap allocation is not required. We perform

[PATCH v3 0/15] Btrfs iomap

2019-09-01 Thread Goldwyn Rodrigues
This is an effort to use iomap for btrfs. This would keep most responsibility of page handling during writes in iomap code, hence code reduction. For CoW support, changes are needed in iomap code to make sure we perform a copy before the write. This is in line with the discussion we had during addi

[PATCH 15/15] btrfs: update inode size during bio completion

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Update the inode size for dio writes during bio completion. This ties the success of the underlying block layer whether to increase the size of the inode. Especially for in aio cases. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 6 +- 1 file changed, 5

[PATCH 07/15] btrfs: remove buffered write code made unnecessary

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Better done in a separate patch to keep the main patch short(er) Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/file.c | 463 1 file changed, 463 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index

[PATCH 04/15] btrfs: Eliminate PagePrivate for btrfs data pages

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues While most of the code works just eliminating page's private field and related code, there is a problem when we are cloning. The extent assumes the data is uptodate. Clear the EXTENT_UPTODATE flag for the extent so the next time the file is read, it is forced to be

[PATCH 11/15] btrfs: Rename __endio_write_update_ordered() to btrfs_update_ordered_extent()

2019-09-01 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 a

[PATCH 06/15] btrfs: Add CoW in iomap based writes

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Set iomap->type to IOMAP_COW and fill up the source map in case the I/O is not page aligned. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/iomap.c | 42 +- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/fs/bt

[PATCH 01/15] iomap: Introduce CONFIG_FS_IOMAP_DEBUG

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues To improve debugging abilities, especially invalid option asserts. Signed-off-by: Goldwyn Rodrigues --- fs/Kconfig| 3 +++ include/linux/iomap.h | 11 +++ 2 files changed, 14 insertions(+) diff --git a/fs/Kconfig b/fs/Kconfig index bfb1c6095c7a

[PATCH 12/15] iomap: use a function pointer for dio submits

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This helps filesystems to perform tasks on the bio while submitting for I/O. Since btrfs requires the position we are working on, pass pos to iomap_dio_submit_bio() Signed-off-by: Goldwyn Rodrigues --- fs/iomap/direct-io.c | 16 +++- include/linux/iomap.h

[PATCH 14/15] btrfs: Remove btrfs_dio_data and __btrfs_direct_write

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_dio_data is unnecessary since we are now storing all informaiton in btrfs_iomap. Advantage: We don't abuse current->journal_info anymore :) --- fs/btrfs/file.c | 40 fs/btrfs/inod

[PATCH 09/15] btrfs: basic direct read operation

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Add btrfs_dio_iomap_ops for iomap.begin() function. In order to accomodate dio reads, add a new function btrfs_file_read_iter() which would call btrfs_dio_iomap_read() for DIO reads and fallback to generic_file_buffered_read otherwise. Changed parameter written in

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

2019-09-01 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

[PATCH 08/15] fs: Export generic_file_buffered_read()

2019-09-01 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Export generic_file_buffered_read() to be used to supplement incomplete direct reads. While we are at it, correct the comments and variable names. Signed-off-by: Goldwyn Rodrigues --- include/linux/fs.h | 2 ++ mm/filemap.c | 13 +++-- 2 files changed

Re: [PATCH v3 0/15] Btrfs iomap

2019-09-03 Thread Goldwyn Rodrigues
On 18:43 02/09, Christoph Hellwig wrote: > On Sun, Sep 01, 2019 at 03:08:21PM -0500, Goldwyn Rodrigues wrote: > > This is an effort to use iomap for btrfs. This would keep most > > responsibility of page handling during writes in iomap code, hence > > code reduction. For CoW

Re: [PATCH 02/15] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-09-03 Thread Goldwyn Rodrigues
On 18:31 02/09, Christoph Hellwig wrote: > On Sun, Sep 01, 2019 at 03:08:23PM -0500, Goldwyn Rodrigues wrote: > > --- a/include/linux/iomap.h > > +++ b/include/linux/iomap.h > > @@ -37,6 +37,7 @@ struct vm_fault; > > #define IOMAP_MAPPED 0x03/* blocks allocat

Re: [PATCH 02/15] iomap: Use a IOMAP_COW/srcmap for a read-modify-write I/O

2019-09-03 Thread Goldwyn Rodrigues
On 20:18 02/09, Darrick J. Wong wrote: > On Mon, Sep 02, 2019 at 06:31:04PM +0200, Christoph Hellwig wrote: > > On Sun, Sep 01, 2019 at 03:08:23PM -0500, Goldwyn Rodrigues wrote: > > > --- a/include/linux/iomap.h > > > +++ b/include/linux/iomap.h > > &g

[PATCH v4 0/15] CoW support for iomap

2019-09-05 Thread Goldwyn Rodrigues
Previously called btrfs iomap. This is an effort to use iomap for btrfs. This would keep most responsibility of page handling during writes in iomap code, hence code reduction. For CoW support, changes are needed in iomap code to make sure we perform a copy before the write. This is in line with t

[PATCH 04/15] btrfs: Add a simple buffered iomap write

2019-09-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This one is a long patch. Most of the code is "inspired" by fs/btrfs/file.c. To keep the size small, all removals are in following patches. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/Kconfig | 1 + fs/btrfs/Makefile | 2 +- fs/btrfs/ctree.h | 1 +

[PATCH 05/15] btrfs: Add CoW in iomap based writes

2019-09-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Set iomap->flags to IOMAP_F_COW and fill up the source map in case the I/O is not page aligned. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/iomap.c | 42 +- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/fs/bt

[PATCH 02/15] iomap: Read page from srcmap if IOMAP_F_COW is set

2019-09-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues In case of a IOMAP_F_COW, read a page from the srcmap before performing a write on the page. Signed-off-by: Goldwyn Rodrigues Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 30 +- include/linux/iomap.h | 3 +++ 2 files changed

[PATCH 01/15] iomap: Use a srcmap for a read-modify-write I/O

2019-09-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues A preparation patch for copy-on-write (CoW). The srcmap is used to identify where the read is to be performed from. This is passed to iomap->begin() of the respective filesystem, which is supposed to put in the details for reading before performing the copy for

  1   2   3   4   >