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

2019-09-05 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 07/15] fs: Export generic_file_buffered_read()

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

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

2019-09-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 10/15] btrfs: Rename __endio_write_update_ordered() to btrfs_update_ordered_extent()

2019-09-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 06/15] btrfs: remove buffered write code made unnecessary

2019-09-05 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 12/15] btrfs: Use iomap_dio_rw for performing direct I/O writes

2019-09-05 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 11/15] iomap: use a function pointer for dio submits

2019-09-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This helps filesystems to perform tasks on the bio while submitting for I/O. This could be post-write operations such as data CRC or data replication for fs-handled RAID. Signed-off-by: Goldwyn Rodrigues --- fs/iomap/direct-io.c | 16 +++- include/linux

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

2019-09-05 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 13/15] btrfs: Remove btrfs_dio_data and __btrfs_direct_write

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

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

2019-09-05 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 15/15] xfs: Use the new iomap infrastructure for CoW

2019-09-05 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Set the IOMAP_F_COW flag and create the srcmap based on current extents to read from. Signed-off-by: Goldwyn Rodrigues --- fs/xfs/xfs_iomap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 8321733c16c3..13495d8a1ee2

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

2019-09-05 Thread Goldwyn Rodrigues
On 18:37 05/09, Christoph Hellwig wrote: > On Thu, Sep 05, 2019 at 10:06:37AM -0500, Goldwyn Rodrigues wrote: > > - else if (iomap->flags & IOMAP_F_BUFFER_HEAD) > > + } else if (iomap->flags & IOMAP_F_COW) { > > + if (WARN_ON_ONCE

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

2019-09-05 Thread Goldwyn Rodrigues
On 18:23 05/09, Christoph Hellwig wrote: > > Most of the code is "inspired" by > > fs/btrfs/file.c. To keep the size small, all removals are in > > following patches. > > Wouldn't it be better to massage the existing code into a form where you > can fairly easily switch over to iomap? That is sta

Re: Odd locking pattern introduced as part of "nowait aio support"

2019-09-11 Thread Goldwyn Rodrigues
On 2:39 11/09, Andres Freund wrote: > > Ok. Goldwyn, do you want to write a patch, or do you want me to write > one up? I'll post one shortly. Thanks for bringing this up. -- Goldwyn

[PATCH 2/3] ext4: fix inode rwsem regression

2019-09-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression") Apparently our current rwsem code doesn't like doing the trylock, then lock for real scheme. So change our read/write methods to just do the trylock for the RWF_NOWAIT case. Fixes: 728fbc0e10b7

[PATCH 3/3] f2fs: fix inode rwsem regression

2019-09-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression") Apparently our current rwsem code doesn't like doing the trylock, then lock for real scheme. So change our read/write methods to just do the trylock for the RWF_NOWAIT case. We don

[PATCH 1/3] btrfs: fix inode rwsem regression

2019-09-11 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression") Apparently our current rwsem code doesn't like doing the trylock, then lock for real scheme. So change our read/write methods to just do the trylock for the RWF_NOWAIT case. Fixes: edf064e7c6fe

Fix inode sem regression for nowait

2019-09-11 Thread Goldwyn Rodrigues
This changes the way we acquire the inode semaphore when the I/O is marked with IOCB_NOWAIT. The regression was discovered in AIM7 and later by Andres in ext4. This has been fixed in XFS by 942491c9e6d6 ("xfs: fix AIM7 regression") I realized f2fs and btrfs also have the same code and need to be u

[PATCH] btrfs: Do not check for PagePrivate twice

2019-10-18 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues We are checking PagePrivate twice, once with lock and once without. Perform the check only once. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/extent_io.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index

[PATCH] btrfs: Do not check for writeback in btrfs_releasepage()

2019-10-18 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues We check for PageWriteback in try_to_release_page(), the sole caller of address_space->releasepage(). We don't need to check it again in btrfs_releasepage() Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH] btrfs: Do not check for writeback in btrfs_releasepage()

2019-10-18 Thread Goldwyn Rodrigues
Scratch this. btrfs_releasepage() is called from btrfs_invalidatepage() as well. Sorry for the noise. On 13:15 18/10, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > We check for PageWriteback in try_to_release_page(), the > sole caller of address_space->releasepage()

[PATCH v2 0/2] Fix locking for btrfs direct writes

2020-12-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues BTRFS direct write takes the inode lock for performing the direct write. In case of a failure or an incomplete write, it falls back to buffered writes. Before initiating the buffered write, it releases the inode lock and reacquires it for buffered write. This may lead to

[PATCH 2/2] btrfs: Make btrfs_direct_write atomic with respect to inode_lock

2020-12-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_direct_write() fallsback to buffered write in case btrfs is not able to perform or complete a direct I/O. During the fallback inode lock is unlocked and relocked. This does not guarantee the atomicity of the entire write since the lock can be acquired by another

[PATCH 1/2] iomap: Separate out generic_write_sync() from iomap_dio_complete()

2020-12-15 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This introduces a separate function __iomap_dio_complte() which completes the Direct I/O without performing the write sync. Filesystems such as btrfs which require an inode_lock for sync can call __iomap_dio_complete() and must perform sync on their own after unlock

Re: [PATCH 2/2] btrfs: Make btrfs_direct_write atomic with respect to inode_lock

2020-12-16 Thread Goldwyn Rodrigues
On 14:13 15/12, Darrick J. Wong wrote: > On Tue, Dec 15, 2020 at 12:06:36PM -0600, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > btrfs_direct_write() fallsback to buffered write in case btrfs is not > > able to perform or complete a direct I/O. During

[PATCH v3] btrfs: Make btrfs_direct_write atomic with respect to inode_lock

2020-12-18 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_direct_write() fallsback to buffered write in case btrfs is not able to perform or complete a direct I/O. During the fallback inode lock is unlocked and relocked. This does not guarantee the atomicity of the entire write since the lock can be acquired by another

[PATCH] btrfs: Remove force argument from run_delalloc_nocow()

2021-02-22 Thread Goldwyn Rodrigues
. should_nocow() has been re-arranged so EXTENT_DEFRAG has higher priority in checks. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4f2f1e932751..2115d8cc6f18

[PATCH] btrfs-progs: Improve default explanation in man page

2021-02-22 Thread Goldwyn Rodrigues
The manpage mentions defaults as on or off. This does not explicitly explain which setting is on, especially in tri-state or more settings. Change defaults to explain which settings are chosen by default. Signed-off-by: Goldwyn Rodrigues --- diff --git a/Documentation/btrfs-man5.asciidoc b

Re: [PATCH] btrfs: Remove force argument from run_delalloc_nocow()

2021-02-24 Thread Goldwyn Rodrigues
On 19:56 24/02, David Sterba wrote: > On Mon, Feb 22, 2021 at 07:17:49AM -0600, Goldwyn Rodrigues wrote: > > force_nocow can be calculated by btrfs_inode and does not need to be > > passed as an argument. > > > > This simplifies run_delalloc_nocow() call from btrfs_run

[PATCH v2] btrfs: Remove force argument from run_delalloc_nocow()

2021-02-25 Thread Goldwyn Rodrigues
W and BTRFS_INODE_PREALLOC flags are checked in need_force_cow(), there is no need to check it again. Signed-off-by: Goldwyn Rodrigues Change since v1: - Kept need_force_cow() as it is --- fs/btrfs/inode.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/inod

Re: [PATCH v2] btrfs: Remove force argument from run_delalloc_nocow()

2021-02-26 Thread Goldwyn Rodrigues
On 18:14 26/02, David Sterba wrote: > On Thu, Feb 25, 2021 at 02:58:22PM -0600, Goldwyn Rodrigues wrote: > > force_nocow can be calculated by btrfs_inode and does not need to be > > passed as an argument. > > > > This simplifies run_delalloc_nocow() call from btrfs_run

[PATCH] btrfs: fix nocow sequence in btrfs_run_delalloc_range()

2021-03-03 Thread Goldwyn Rodrigues
. Fixes: 7e33213f8ccc btrfs: remove force argument from run_delalloc_nocow() Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 27 ++- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0b133fda4f5d..ceb6ca7c571d

[PATCH] btrfs: Remove mirror argument from btrfs_csum_verify_data()

2021-03-03 Thread Goldwyn Rodrigues
Unused variable: mirror. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 2 +- fs/btrfs/extent_io.c | 3 +-- fs/btrfs/inode.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 014afeb8d626..5776026c532e 100644 --- a

[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: 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 v3] btrfs: remove force argument from run_delalloc_nocow()

2021-03-04 Thread Goldwyn Rodrigues
ither BTRFS_INODE_NODATA or BTRFS_INODE_PREALLOC, but is not a defrag extent. Signed-off-by: Goldwyn Rodrigues Reviewed-by: David Sterba Signed-off-by: David Sterba Tested-by: Johannes Thumshirn Reviewed-by: Johannes Thumshirn Changes since v2: - merge should_nocow() functionality to fix bug where nocow pat

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-03-09 Thread Goldwyn Rodrigues
Hi Shiang, Thanks for picking up this work. On 8:20 26/02, Shiyang Ruan wrote: > This patchset is attempt to add CoW support for fsdax, and take XFS, > which has both reflink and fsdax feature, as an example. How does this work for read sequence for two different files mapped to the same extent

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-03-10 Thread Goldwyn Rodrigues
On 13:02 10/03, Matthew Wilcox wrote: > On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > > Forgive my ignorance, but is there a reason why this isn't wired up to > > Btrfs at the same time? It seems weird to me that adding a feature > > btrfs doesn't support DAX. only ext2, ext4, XFS

Re: [PATCH v2 00/10] fsdax,xfs: Add reflink&dedupe support for fsdax

2021-03-10 Thread Goldwyn Rodrigues
On 14:26 10/03, Matthew Wilcox wrote: > On Wed, Mar 10, 2021 at 08:21:59AM -0600, Goldwyn Rodrigues wrote: > > On 13:02 10/03, Matthew Wilcox wrote: > > > On Wed, Mar 10, 2021 at 07:30:41AM -0500, Neal Gompa wrote: > > > > Forgive my ignorance, but is there a rea

[PATCH 2/2] btrfs: Use reada_control pointer instead of void pointer

2021-04-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Since struct reada_control is defined in ctree.h, Use struct reada_control pointer as a function argument for btrfs_reada_wait() instead of a void pointer in order to avoid type-casting within the function. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 2

[PATCH 1/2] btrfs: Remove unused function btrfs_reada_detach()

2021-04-06 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_reada_detach() is not called by any function. Remove. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 1 - fs/btrfs/reada.c | 9 + 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index f2fd73e58ee6

[PATCH] btrfs: Correct try_lock_extent() usage in read_extent_buffer_subpage()

2021-04-08 Thread Goldwyn Rodrigues
try_lock_extent() returns 1 on success or 0 for failure and not an error code. If try_lock_extent() fails, read_extent_buffer_subpage() returns zero indicating subpage extent read success. Return EAGAIN/EWOULDBLOCK if try_lock_extent() fails in locking the extent. Signed-off-by: Goldwyn

[PATCH] btrfs-progs: Correct check_running_fs_exclop() return value

2021-04-09 Thread Goldwyn Rodrigues
check_running_fs_exclop() can return 1 when exclop is changed to "none" The ret is set by the return value of the select() operation. Checking the exclusive op changes just the exclop variable while ret is still set to 1. Set ret exclusively if exclop is set to BTRFS_EXCL_NONE. --- common/utils.c

Re: [PATCH] btrfs-progs: Correct check_running_fs_exclop() return value

2021-04-12 Thread Goldwyn Rodrigues
On 6:50 10/04, Anand Jain wrote: > On 09/04/2021 23:56, Goldwyn Rodrigues wrote: > > check_running_fs_exclop() can return 1 when exclop is changed to "none" > > The ret is set by the return value of the select() operation. Checking > > the exclusive op changes jus

[PATCH 2/3] btrfs: Initialize inode->i_op once in btrfs_symlink

2019-02-25 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues inode->i_op is initialized multiple times. Perform it once. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5c349667c761..9b77fe994cbb 100644 --- a/fs/btrfs/inode.c ++

[PATCH 1/3] btrfs: Initialize btrfs_io_ctl instead of memsetting it

2019-02-25 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues io_ctl_init() memsets it to zero anyways. However, I presume the memset was added to avoid the WARN_ON in io_ctl_init(). Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/free-space-cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/free

[PATCH 3/3] btrfs: Perform locking/unlocking in btrfs_remap_file_range()

2019-02-25 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Moves code to make it more readable, so as locking and unlocking is done in the same function. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ioctl.c | 53 + 1 file changed, 21 insertions(+), 32 deletions(-) diff

Re: [PATCH 3/3] btrfs: Perform locking/unlocking in btrfs_remap_file_range()

2019-02-26 Thread Goldwyn Rodrigues
On 12:08 26/02, Filipe Manana wrote: > On Mon, Feb 25, 2019 at 7:08 PM Goldwyn Rodrigues wrote: > > > > From: Goldwyn Rodrigues > > > > Moves code to make it more readable, so as locking and unlocking is > > done in the same function. > > > > Sign

Re: [PATCH 1/3] btrfs: Initialize btrfs_io_ctl instead of memsetting it

2019-02-27 Thread Goldwyn Rodrigues
On 16:47 27/02, David Sterba wrote: > On Mon, Feb 25, 2019 at 01:07:42PM -0600, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > io_ctl_init() memsets it to zero anyways. However, I presume the > > memset was added to avoid the WARN_ON in io_ctl_init(). &

[PATCH 05/15] btrfs: return whether extent is nocow or not

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues We require this to set the IOMAP_F_COW flag in iomap structure, in the later patches. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 2 +- fs/btrfs/inode.c | 9 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs

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

2019-03-26 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/15] btrfs: Carve out btrfs_get_extent_map_write() out of btrfs_get_blocks_write()

2019-03-26 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/15] btrfs: basic dax read

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Perform a basic read using iomap support. The btrfs_iomap_begin() finds the extent at the position and fills the iomap data structure with the values. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/Makefile | 1 + fs/btrfs/ctree.h | 5 + fs/btrfs/dax.c| 49

[no subject]

2019-03-26 Thread Goldwyn Rodrigues
Subject: [PATCH v2 00/15] btrfs dax support This patch set adds support for dax on the BTRFS filesystem. In order to support for CoW for btrfs, there were changes which had to be made to the dax handling. The important one is copying blocks into the same dax device before using them. I have some

[PATCH 04/15] dax: Introduce IOMAP_F_COW for copy-on-write

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues The IOMAP_F_COW is a flag to notify dax that it needs to copy the data from iomap->cow_addr to iomap->addr, if the start/end of I/O are not page aligned. This also introduces dax_to_dax_copy() which performs a copy from one part of the device to another, to a maxi

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

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This sets S_DAX in inode->i_flags, which can be used with IS_DAX(). The dax option is restricted to non multi-device mounts. dax interacts with the device directly instead of using bio, so all bio-hooks which we use for multi-device cannot be performed here. Wh

[PATCH 14/15] btrfs: Disable dax-based defrag and send

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is temporary, and a TODO. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ioctl.c | 13 + fs/btrfs/send.c | 4 2 files changed, 17 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2e5137b01561..f532a8df2026 100644 --- a/fs

[PATCH 09/15] btrfs: add dax mmap support

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Add a new vm_operations struct btrfs_dax_vm_ops specifically for dax files. Since we will be removing(nulling) readpages/writepages for dax return ENOEXEC only for non-dax files. dax_insert_entry() looks ugly. Do you think we should break it into dax_insert_cow_entry

[PATCH 08/15] dax: add dax_iomap_cow to copy a mmap page before writing

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues dax_iomap_cow copies a page before presenting for mmap. Signed-off-by: Goldwyn Rodrigues --- fs/dax.c | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/fs/dax.c b/fs/dax.c index e254535dd830..21ee3df6f02c 100644 --- a

[PATCH 15/15] btrfs: Writeprotect mmap pages on snapshot

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Inorder to make sure mmap'd files don't change after snapshot, writeprotect the mmap pages on snapshot. This is done by performing a data writeback on the pages (which simply mark the pages are wrprotected). This way if the user process tries to access the memo

[PATCH 10/15] btrfs: Add dax specific address_space_operations

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/inode.c | 34 +++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f721fc1e3f7f..21780ea14e5a 100644 --- a/fs/btrfs/inode.c +++ b/fs

[PATCH 12/15] btrfs: trace functions for btrfs_iomap_begin/end

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues This is for debug purposes only and can be skipped. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/dax.c | 3 +++ include/trace/events/btrfs.h | 56 2 files changed, 59 insertions(+) diff --git a/fs/btrfs

[PATCH 13/15] btrfs: handle dax page zeroing

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues btrfs_dax_zero_block() zeros part of the page, either from the front or the regular rest of the block. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/ctree.h | 1 + fs/btrfs/dax.c| 29 +++-- fs/btrfs/inode.c | 4 fs/dax.c

[PATCH 07/15] btrfs: add dax write support

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues IOMAP_F_COW allows to inform the dax code, to first perform a copy which are not page-aligned before performing the write. A new struct btrfs_iomap is passed from iomap_begin() to iomap_end(), which contains all the accounting and locking information for CoW based writes

[PATCH 11/15] fs: dedup file range to use a compare function

2019-03-26 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues With dax we cannot deal with readpage() etc. So, we create a funciton callback to perform the file data comparison and pass it to generic_remap_file_range_prep() so it can use iomap-based functions. This may not be the best way to solve this. Suggestions welcome. Signed

[PATCH v2 00/15] btrfs dax support

2019-03-26 Thread Goldwyn Rodrigues
Sorry, messed up the subject the first time. This patch set adds support for dax on the BTRFS filesystem. In order to support for CoW for btrfs, there were changes which had to be made to the dax handling. The important one is copying blocks into the same dax device before using them. I have some

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

2019-03-27 Thread Goldwyn Rodrigues
On 12:10 26/03, Matthew Wilcox wrote: > On Tue, Mar 26, 2019 at 02:02:47PM -0500, Goldwyn Rodrigues wrote: > > This sets S_DAX in inode->i_flags, which can be used with > > IS_DAX(). > > > > The dax option is restricted to non multi-device mounts. > > da

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

2019-03-27 Thread Goldwyn Rodrigues
On 12:36 26/03, Dan Williams wrote: > On Wed, Dec 5, 2018 at 4:29 AM Goldwyn Rodrigues wrote: > > > > From: Goldwyn Rodrigues > > > > These functions are required for btrfs dax support. > > > > Signed-off-by: Goldwyn Rodrigues

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

2019-03-27 Thread Goldwyn Rodrigues
On 5:00 27/03, Matthew Wilcox wrote: > On Wed, Mar 27, 2019 at 06:00:52AM -0500, Goldwyn Rodrigues wrote: > > On 12:10 26/03, Matthew Wilcox wrote: > > > On Tue, Mar 26, 2019 at 02:02:47PM -0500, Goldwyn Rodrigues wrote: > > > > This sets S_DAX in inode-&g

Re: [PATCH 04/15] dax: Introduce IOMAP_F_COW for copy-on-write

2019-03-27 Thread Goldwyn Rodrigues
On 10:54 27/03, Darrick J. Wong wrote: > On Tue, Mar 26, 2019 at 02:02:50PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > The IOMAP_F_COW is a flag to notify dax that it needs to copy > > the data from iomap->cow_addr to iomap->addr, if the

Re: [PATCH v2 00/15] btrfs dax support

2019-03-27 Thread Goldwyn Rodrigues
On 21:14 27/03, Adam Borowski wrote: > On Tue, Mar 26, 2019 at 02:09:08PM -0500, Goldwyn Rodrigues wrote: > > This patch set adds support for dax on the BTRFS filesystem. > > This patchset doesn't seem to support MAP_SYNC, which is the usual way to > use (and detect) DAX.

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

2019-03-27 Thread Goldwyn Rodrigues
On 5:00 27/03, Matthew Wilcox wrote: > On Wed, Mar 27, 2019 at 06:00:52AM -0500, Goldwyn Rodrigues wrote: > > On 12:10 26/03, Matthew Wilcox wrote: > > > On Tue, Mar 26, 2019 at 02:02:47PM -0500, Goldwyn Rodrigues wrote: > > > > This sets S_DAX in inode-&g

Re: [PATCH] btrfs: allow MAP_SYNC mmap

2019-04-01 Thread Goldwyn Rodrigues
On 11:24 28/03, Adam Borowski wrote: > Used by userspace to detect DAX. Thanks. I will add it to the series. > > Signed-off-by: Adam Borowski > --- > fs/btrfs/file.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c > index 196c8f37ff9d..8efdb040bc1d

Re: [PATCH 11/15] fs: dedup file range to use a compare function

2019-04-01 Thread Goldwyn Rodrigues
On 10:04 28/03, Darrick J. Wong wrote: > On Tue, Mar 26, 2019 at 02:02:57PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > With dax we cannot deal with readpage() etc. So, we create a > > funciton callback to perform the file data co

Re: [PATCH 07/15] btrfs: add dax write support

2019-04-01 Thread Goldwyn Rodrigues
On 7:53 28/03, Darrick J. Wong wrote: > On Tue, Mar 26, 2019 at 02:02:53PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > IOMAP_F_COW allows to inform the dax code, to first perform > > a copy which are not page-aligned before performing the w

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

2019-04-01 Thread Goldwyn Rodrigues
On 18:28 28/03, David Sterba wrote: > On Tue, Mar 26, 2019 at 02:02:47PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > This sets S_DAX in inode->i_flags, which can be used with > > IS_DAX(). > > > > The dax option is restricted to

Re: [PATCH 04/15] dax: Introduce IOMAP_F_COW for copy-on-write

2019-04-01 Thread Goldwyn Rodrigues
On 15:38 01/04, Dave Chinner wrote: > On Tue, Mar 26, 2019 at 02:02:50PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > The IOMAP_F_COW is a flag to notify dax that it needs to copy > > the data from iomap->cow_addr to iomap->addr, if the

Re: [PATCH 04/15] dax: Introduce IOMAP_F_COW for copy-on-write

2019-04-02 Thread Goldwyn Rodrigues
On 10:06 02/04, Dave Chinner wrote: > On Mon, Apr 01, 2019 at 04:41:02PM -0500, Goldwyn Rodrigues wrote: > > On 15:38 01/04, Dave Chinner wrote: > > > On Tue, Mar 26, 2019 at 02:02:50PM -0500, Goldwyn Rodrigues wrote: > > > > From: Goldwyn Rodrigues > > >

Re: [PATCH 08/18] dax: memcpy page in case of IOMAP_DAX_COW for mmap faults

2019-05-22 Thread Goldwyn Rodrigues
On 10:46 21/05, Darrick J. Wong wrote: > On Mon, Apr 29, 2019 at 12:26:39PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > Change dax_iomap_pfn to return the address as well in order to > > use it for performing a memcpy in case the type is IOMAP_D

Re: [PATCH 04/18] dax: Introduce IOMAP_DAX_COW to CoW edges during writes

2019-05-22 Thread Goldwyn Rodrigues
On 9:51 21/05, Darrick J. Wong wrote: > On Mon, Apr 29, 2019 at 12:26:35PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > The IOMAP_DAX_COW is a iomap type which performs copy of > > edges of data while performing a write if start/end are >

Re: [PATCH 03/18] btrfs: basic dax read

2019-05-22 Thread Goldwyn Rodrigues
On 8:14 21/05, Darrick J. Wong wrote: > On Mon, Apr 29, 2019 at 12:26:34PM -0500, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > Perform a basic read using iomap support. The btrfs_iomap_begin() > > finds the extent at the position and fills the iomap

Re: [PATCH 04/18] dax: Introduce IOMAP_DAX_COW to CoW edges during writes

2019-05-23 Thread Goldwyn Rodrigues
On 17:05 23/05, Shiyang Ruan wrote: > > > On 5/22/19 12:51 AM, Darrick J. Wong wrote: > > On Mon, Apr 29, 2019 at 12:26:35PM -0500, Goldwyn Rodrigues wrote: > > > From: Goldwyn Rodrigues > > > > > > The IOMAP_DAX_COW is a iomap type which performs copy

Re: [PATCH 16/18] btrfs: Writeprotect mmap pages on snapshot

2019-05-23 Thread Goldwyn Rodrigues
On 16:04 23/05, Jan Kara wrote: > On Mon 29-04-19 12:26:47, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues > > > > Inorder to make sure mmap'd files don't change after snapshot, > > writeprotect the mmap pages on snapshot. This is done by performing >

Re: [PATCH 16/18] btrfs: Writeprotect mmap pages on snapshot

2019-05-23 Thread Goldwyn Rodrigues
On 21:07 23/05, Jan Kara wrote: > On Thu 23-05-19 10:27:22, Goldwyn Rodrigues wrote: > > On 16:04 23/05, Jan Kara wrote: > > > On Mon 29-04-19 12:26:47, Goldwyn Rodrigues wrote: > > > > From: Goldwyn Rodrigues > > > > > > > > Inorder

[PATCH] btrfs: Evaluate io_tree in find_lock_delalloc_range()

2019-06-18 Thread Goldwyn Rodrigues
Simplification. No point passing the tree variable when it can be evaluated from inode. Signed-off-by: Goldwyn Rodrigues --- fs/btrfs/extent_io.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index db337e53aab3

Re: [PATCH] btrfs: Evaluate io_tree in find_lock_delalloc_range()

2019-06-19 Thread Goldwyn Rodrigues
On 9:05 19/06, Nikolay Borisov wrote: > > > On 19.06.19 г. 3:35 ч., Goldwyn Rodrigues wrote: > > Simplification. > > No point passing the tree variable when it can be evaluated > > from inode. > > > > Signed-off-by: Goldwyn Rodrigues > > The patch

[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: [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 comme

[PATCH] btrfs-progs: repair: Trickle down EEXISTS while freeing

2016-10-27 Thread Goldwyn Rodrigues
fs_to_drop=refs_to_drop@entry=1) at extent-tree.c:2410 #6 del_pending_extents (trans=trans@entry=0x7e7240, extent_root=0x6a88a0) at extent-tree.c:2448 Signed-off-by: Goldwyn Rodrigues diff --git a/extent-tree.c b/extent-tree.c index 3b1577e..a21e369 100644 --- a/extent-tree.c +++ b/extent-tre

Re: [PATCH] btrfs-progs: repair: Trickle down EEXISTS while freeing

2016-10-28 Thread Goldwyn Rodrigues
On 10/28/2016 09:42 AM, David Sterba wrote: > On Thu, Oct 27, 2016 at 01:05:08PM -0500, Goldwyn Rodrigues wrote: >> While deleting pending extents, we insert extents to the >> extent_tree. However, because of corruption, this might already >> be freed. We trickle the EEXI

Re: [PATCH 0/4] Qgroup comment enhance and balance fix

2016-10-28 Thread Goldwyn Rodrigues
On 10/27/2016 07:33 PM, Qu Wenruo wrote: > Any comment? > > Especially the final patch will fix a long standing bug. > While I have tested it, and it works, I did not get time to review it. So, you can have my Tested-by: Goldwyn Rodrigues > Thanks, > Qu > > At

Re: [PATCH] btrfs-progs: repair: Trickle down EEXISTS while freeing

2016-10-31 Thread Goldwyn Rodrigues
Hi David, On 10/28/2016 09:42 AM, David Sterba wrote: > On Thu, Oct 27, 2016 at 01:05:08PM -0500, Goldwyn Rodrigues wrote: >> While deleting pending extents, we insert extents to the >> extent_tree. However, because of corruption, this might already be >> freed. We trickle

Re: [PATCH 2/4] btrfs: qgroup: Rename functions to make it follow reserve,trace,account steps

2016-11-03 Thread Goldwyn Rodrigues
Reviewed-and-Tested-by: Goldwyn Rodrigues On 10/17/2016 08:31 PM, Qu Wenruo wrote: > Rename btrfs_qgroup_insert_dirty_extent(_nolock) to > btrfs_qgroup_trace_extent(_nolock), according to the new > reserve/trace/account naming schema. > > Signed-off-by: Qu Wenruo > --- &

Re: [PATCH 1/4] btrfs: qgroup: Add comments explaining how btrfs qgroup works

2016-11-03 Thread Goldwyn Rodrigues
Reviewed-by: Goldwyn Rodrigues On 10/17/2016 08:31 PM, Qu Wenruo wrote: > Add explain how btrfs qgroup works. > > Qgroup is split into 3 main phrases: > 1) Reserve >To ensure qgroup doesn't exceed its limit > > 2) Trace >To info qgroup to trace

Re: [PATCH 4/4] btrfs: qgroup: Fix qgroup data leaking by using subtree tracing

2016-11-03 Thread Goldwyn Rodrigues
Reviewed-and-Tested-by: Goldwyn Rodrigues On 10/17/2016 08:31 PM, Qu Wenruo wrote: > Commit 62b99540a1d91e464 (btrfs: relocation: Fix leaking qgroups numbers > on data extents) only fixes the problem partly. > > The previous fix is to trace all new data extents at transaction commit

Re: [PATCH 3/4] btrfs: Expoert and move leaf/subtree qgroup helpers to qgroup.c

2016-11-03 Thread Goldwyn Rodrigues
Reviewed-and-Tested-by: Goldwyn Rodrigues On 10/17/2016 08:31 PM, Qu Wenruo wrote: > Move account_shared_subtree() to qgroup.c and rename it to > btrfs_qgroup_trace_subtree(). > > Do the same thing for account_leaf_items() and rename it to > btrfs_qgroup_trace_leaf_items(). >

[PATCH] Return best entry, if it is the first one

2016-11-10 Thread Goldwyn Rodrigues
. Signed-off-by: Goldwyn Rodrigues --- cmds-check.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index 368c1c5..779870a 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -8184,11 +8184,6 @@ static struct extent_entry *find_most_right_entry

[PATCH] btrfs-progs: Fix extents after finding all errors

2016-11-10 Thread Goldwyn Rodrigues
show all errors and then fix the extents. Set a variable and call fixup_extent_ref() if it is set. err is not used, so cleared it. Signed-off-by: Goldwyn Rodrigues --- cmds-check.c | 75 +++- 1 file changed, 24 insertions(+), 51 deletions

[PATCH 1/2] btrfs-progs: Correct value printed by assertions/BUG_ON/WARN_ON

2016-11-29 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues The values passed to BUG_ON/WARN_ON are negated(!) and printed, which results in printing the value zero for each bug/warning. For example: volumes.c:988: btrfs_alloc_chunk: Assertion `ret` failed, value 0 This is not useful. Instead changed to print the value of the

[PATCH 2/2] btrfs-progs: Remove duplicate printfs in warning_trace()/assert_trace()

2016-11-29 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Code reduction. Call warning_trace from assert_trace in order to reduce the printf's used. Also, trace variable in warning_trace() is not required because it is already handled by BTRFS_DISABLE_BACKTRACE. Signed-off-by: Goldwyn Rodrigues --- kerncompat.h

<    1   2   3   4   >