Re: [PATCH 1/2] fstests: btrfs: Make seed device test cases into their own group

2019-01-09 Thread Anand Jain
On 01/10/2019 02:14 PM, Qu Wenruo wrote: btrfs/16[123] are all seed device related test cases, make them into 'seed' group. Signed-off-by: Qu Wenruo Reviewed-by: Anand Jain --- tests/btrfs/group | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t

Re: [PATCH] Btrfs: avoid deadlock with memory reclaim due to allocation of devices

2019-01-09 Thread Anand Jain
blem, this patch is still ok as its drops the unnecessary device_list_mutex in btrfs_update_commit_device_size(). So for that if the change log updated, Reviewed-by: Anand Jain To address the actual problem. Functions which call btrfs_alloc_device() are.. device_list_add() close_fs_devices() b

Re: [PATCH v2] btrfs: add kernel scrub log messages

2019-01-10 Thread Anand Jain
On 01/03/2019 04:17 PM, Anand Jain wrote: scrub kernel messages helps debug and audit, add them to the log. Signed-off-by: Anand Jain Ping. Thanks. --- v1->v2: fix btrfs_info, using string directly. Add spacing. fs/btrfs/scrub.c | 5 + 1 file changed, 5 insertions(+) diff --

Re: [PATCH v2] Btrfs: avoid deadlock with memory reclaim due to allocation of devices

2019-01-14 Thread Anand Jain
On 01/12/2019 01:17 AM, fdman...@kernel.org wrote: From: Filipe Manana In a few places we are allocating a device using the GFP_KERNEL flag when it is not safe to do so, because if reclaim is triggered it can cause a transaction commit while we are holding the device list mutex. This mutex i

[PATCH RESEND 1/2] btrfs-progs: check for no result before using results

2019-01-15 Thread Anand Jain
User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status using the struct btrfs_ioctl_dev_replace_args::result, and so userspace initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude this value in checking for the error. Signed-off-by: Anand Jain --- cmds

[PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report

2019-01-15 Thread Anand Jain
ernel returns BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS for the above cli, if the balance is running. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov --- cmds-replace.c | 4 1 file changed, 4 insertions(+) diff --git a/cmds-replace.c b/cmds-replace.c index 42de4de8c031..696f24c5c6d5 100644 --- a/cmds-replace.c +++ b/c

[PATCH 0/6] btrfs: find_device cleanups

2019-01-17 Thread Anand Jain
struct btrfs_device of a userland given device_path. Anand Jain (6): btrfs: merge btrfs_find_device_missing_or_by_path() into parent btrfs: cleanup btrfs_find_device_by_devspec() btrfs: rename btrfs_find_device_by_path() btrfs: refactor btrfs_find_device() take fs_devices as argument btrfs

[PATCH 6/6] btrfs: refactor btrfs_find_device() return error code

2019-01-17 Thread Anand Jain
Refactor btrfs_find_device() to return standard error code. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 4 ++-- fs/btrfs/ioctl.c | 4 ++-- fs/btrfs/scrub.c | 12 fs/btrfs/volumes.c | 32 +--- 4 files changed, 25 insertions

[PATCH 5/6] btrfs: merge btrfs_find_device() and find_device()

2019-01-17 Thread Anand Jain
Both btrfs_find_device() and find_device() does the same things expect that latter function is not keen in seed device in the scan-context. So merge them. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 4 +-- fs/btrfs/ioctl.c | 4 +-- fs/btrfs/scrub.c | 4 +-- fs/btrfs

[PATCH 2/6] btrfs: cleanup btrfs_find_device_by_devspec()

2019-01-17 Thread Anand Jain
btrfs_find_device_by_devspec() finds the device by @devid or by @device_path. This patch makes code flow easy to read by open coding the else part and renames devpath to device_path. Signed-off-by: Anand Jain --- If the else is preferred, I am ok to keep them. Nikolay? fs/btrfs/volumes.c | 34

[PATCH 1/6] btrfs: merge btrfs_find_device_missing_or_by_path() into parent

2019-01-17 Thread Anand Jain
btrfs_find_device_missing_or_by_path() is relatively small function, and its only parent btrfs_find_device_by_devspec() is small as well. Besides there are a number of find_device functions. Merge btrfs_find_device_missing_or_by_path() into its parent. Signed-off-by: Anand Jain --- fs/btrfs

[PATCH 4/6] btrfs: refactor btrfs_find_device() take fs_devices as argument

2019-01-17 Thread Anand Jain
btrfs_find_device() accepts fs_info as an argument and retrieves fs_devices from fs_info. Instead send fs_devices, so that this function can be used in non mounted (scanned) context as well. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 6 +++--- fs/btrfs/ioctl.c | 5 +++-- fs

[PATCH 3/6] btrfs: rename btrfs_find_device_by_path()

2019-01-17 Thread Anand Jain
btrfs_find_device_by_path() is a helper function, drop the btrfs prefix and the suffix _path is too generic, in fact as it reads superblock to find the btrfs_device, so rename it to find_device_by_superblock() Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2

Re: [PATCH 3/6] btrfs: rename btrfs_find_device_by_path()

2019-01-17 Thread Anand Jain
On 01/17/2019 11:54 PM, David Sterba wrote: On Thu, Jan 17, 2019 at 11:32:30PM +0800, Anand Jain wrote: btrfs_find_device_by_path() is a helper function, drop the btrfs prefix and the suffix _path is too generic, in fact as it reads superblock to find the btrfs_device, so rename it to

Re: [PATCH 6/6] btrfs: refactor btrfs_find_device() return error code

2019-01-17 Thread Anand Jain
On 01/17/2019 11:49 PM, David Sterba wrote: On Thu, Jan 17, 2019 at 11:32:33PM +0800, Anand Jain wrote: Refactor btrfs_find_device() to return standard error code. Do you intend to add more error codes? No actually. code like this ... if (PTR_ERR(device) == -ENOENT) can be if

[PATCH 5/6 v2] btrfs: merge btrfs_find_device() and find_device()

2019-01-18 Thread Anand Jain
Both btrfs_find_device() and find_device() does the same things expect that latter function is not keen in seed device in the scan-context. So merge them. Signed-off-by: Anand Jain --- v2: use bool instead of int. use positive meaning instead of negative. conflict fix: due to 1b3922a8bc7

Re: [PATCH 0/6] btrfs: find_device cleanups

2019-01-18 Thread Anand Jain
On 01/19/2019 01:33 AM, David Sterba wrote: On Thu, Jan 17, 2019 at 11:32:27PM +0800, Anand Jain wrote: find_device and its helper functions are as below btrfs_find_device_by_devspec() btrfs_find_device_missing_or_by_path() btrfs_find_device_by_path() btrfs_find_device

Re: [PATCH v2 2/3] btrfs: add read_mirror_policy parameter devid

2019-01-22 Thread Anand Jain
On 01/21/2019 07:56 PM, Steven Davies wrote: On 2018-05-16 11:03, Anand Jain wrote: Going back to an old patchset I was testing this weekend: Adds the mount option:   mount -o read_mirror_policy= To set the devid of the device which should be used for read. That means all the normal reads

Re: [PATCH 5/6 v2] btrfs: merge btrfs_find_device() and find_device()

2019-01-22 Thread Anand Jain
On 01/19/2019 02:48 PM, Anand Jain wrote: Both btrfs_find_device() and find_device() does the same things expect that latter function is not keen in seed device in the scan-context. So merge them. Signed-off-by: Anand Jain A gentle ping. Thanks, Anand --- v2: use bool instead of int

Re: [PATCH v2] btrfs: add kernel scrub log messages

2019-01-24 Thread Anand Jain
On 01/25/2019 04:21 AM, David Sterba wrote: On Thu, Jan 03, 2019 at 04:17:40PM +0800, Anand Jain wrote: scrub kernel messages helps debug and audit, add them to the log. Signed-off-by: Anand Jain --- v1->v2: fix btrfs_info, using string directly. Add spacing. fs/btrfs/scrub.c

Re: Nasty corruption on large array, ideas welcome

2019-01-24 Thread Anand Jain
On 01/24/2019 01:30 AM, Thiago Ramon wrote: Back again with more info. I've done a dump-tree on my array, and from the 71GB of tree data, I've only got the following errors: parent transid verify failed on 31288448466944 wanted 135681 found 135575 parent transid verify failed on 3128844846694

Re: [PATCH v2] Btrfs: avoid deadlock with memory reclaim due to allocation of devices

2019-01-24 Thread Anand Jain
On 01/19/2019 02:07 AM, David Sterba wrote: On Mon, Jan 14, 2019 at 04:21:43PM +0800, Anand Jain wrote: On 01/12/2019 01:17 AM, fdman...@kernel.org wrote: From: Filipe Manana In a few places we are allocating a device using the GFP_KERNEL flag when it is not safe to do so, because if

Re: [PATCH v2] Btrfs: avoid deadlock with memory reclaim due to allocation of devices

2019-01-24 Thread Anand Jain
On 01/12/2019 01:17 AM, fdman...@kernel.org wrote: From: Filipe Manana In a few places we are allocating a device using the GFP_KERNEL flag when it is not safe to do so, because if reclaim is triggered it can cause a transaction commit while we are holding the device list mutex. This mutex i

Re: [PATCH RESEND 1/2] btrfs-progs: check for no result before using results

2019-01-25 Thread Anand Jain
On 1/16/19 11:13 AM, Anand Jain wrote: User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status using the struct btrfs_ioctl_dev_replace_args::result, and so userspace initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude this value in checking for the error

Re: [PATCH] btrfs: oops in device_list_add()

2019-01-28 Thread Anand Jain
On 1/27/19 12:58 PM, Al Viro wrote: alloc_fs_devices() can return ERR_PTR(-ENOMEM), so dereferencing its result before the check for IS_ERR() is a bad idea... Fixes: d1a63002829a4 Signed-off-by: Al Viro nice catch. Reviewed-by: Anand Jain --- diff --git a/fs/btrfs/volumes.c b

[PATCH v4 3/3] btrfs: scrub: convert scrub_workers_refcnt to refcount_t

2019-01-29 Thread Anand Jain
Use the refcount_t for fs_info::scrub_workers_refcnt instead of int. Signed-off-by: Anand Jain --- v4: born fs/btrfs/ctree.h | 2 +- fs/btrfs/disk-io.c | 2 +- fs/btrfs/scrub.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h

[PATCH v4 2/3] btrfs: scrub: add scrub_lock lockdep check in scrub_workers_get

2019-01-29 Thread Anand Jain
scrub_workers_refcnt is protected by scrub_lock, add lockdep_assert_held() in scrub_workers_get(). Signed-off-by: Anand Jain Suggested-by: Nikolay Borisov --- v4: none v3: none v2: born fs/btrfs/scrub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c

[PATCH v4 1/3] btrfs: scrub: fix circular locking dependency warning

2019-01-29 Thread Anand Jain
d3937700 R11: 0246 R12: 0000 [ 76.174566] R13: 00801000 R14: R15: 7f61d3937700 [ 76.175217] btrfs (4065) used greatest stack depth: 11424 bytes left Signed-off-by: Anand Jain --- v3->v4: Fix list corruption as reported by btrfs/073 by David

[PATCH v4 0/3] btrfs: scrub: fix scrub_lock

2019-01-29 Thread Anand Jain
Fixes the circular locking dependency warning as in patch 1/3, and patch 2/3 adds lockdep_assert_held() to scrub_workers_get(). Patch 3/3 converts scrub_workers_refcnt into refcount_t. Anand Jain (3): btrfs: scrub: fix circular locking dependency warning btrfs: scrub: add scrub_lock lockdep

Re: [PATCH v4 1/3] btrfs: scrub: fix circular locking dependency warning

2019-01-30 Thread Anand Jain
On 1/30/19 10:07 PM, David Sterba wrote: On Wed, Jan 30, 2019 at 02:45:00PM +0800, Anand Jain wrote: v3->v4: Fix list corruption as reported by btrfs/073 by David. [1] https://patchwork.kernel.org/patch/10705741/ Which I was able to reproduce with

Re: [PATCH 1/2] btrfs: Don't search devid for every verify_one_dev_extent() call

2019-01-31 Thread Anand Jain
() once. This does not apply on misc-next. Looks like this patch's branch is missing the seed fix. Looks good. Reviewed-by: Anand Jain Signed-off-by: Qu Wenruo --- fs/btrfs/volumes.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git

[PATCH RESEND 2/2] btrfs-progs: replace: gracefully handle the exclusive operation report

2019-01-31 Thread Anand Jain
ernel returns BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS for the above cli, if the balance is running. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov --- cmds-replace.c | 4 1 file changed, 4 insertions(+) diff --git a/cmds-replace.c b/cmds-replace.c index 42de4de8c031..696f24c5c6d5 100644 --- a/cmds-replace.c +++ b/c

[PATCH RESEND 1/2] btrfs-progs: check for no result before using results

2019-01-31 Thread Anand Jain
User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status using the struct btrfs_ioctl_dev_replace_args::result, and so userspace initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude this value in checking for the error. Signed-off-by: Anand Jain --- cmds

Re: [PATCH v14] Add cli and ioctl to forget scanned device(s)

2019-02-06 Thread Anand Jain
On 2/6/19 11:33 PM, David Sterba wrote: On Fri, Jan 04, 2019 at 01:31:51PM +0800, Anand Jain wrote: Adds cli and ioctl to forget a scanned device or forget all stale devices in the kernel. Anand Jain (2): btrfs: refactor btrfs_free_stale_devices() to get return value btrfs: introduce

Re: [PATCH RESEND 1/2] btrfs-progs: check for no result before using results

2019-02-07 Thread Anand Jain
Ping? Thanks, Anand On 1/31/19 6:05 PM, Anand Jain wrote: User space understands the ioctl BTRFS_IOC_DEV_REPLACE command status using the struct btrfs_ioctl_dev_replace_args::result, and so userspace initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude this value in

[PATCH 3/5] btrfs: reorg functions to drop forward declaration

2019-02-07 Thread Anand Jain
file. No functional changes. Signed-off-by: Anand Jain --- fs/btrfs/props.c | 157 --- 1 file changed, 79 insertions(+), 78 deletions(-) diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c index 4525a2a4d1cd..6f52e3d21012 100644 --- a/fs/btrfs

[PATCH 4/5] btrfs: drop redundant forward declaration in props.c

2019-02-07 Thread Anand Jain
Drop forward declaration of the functions, prop_compression_validate(), prop_compression_apply() and prop_compression_extract(). Signed-off-by: Anand Jain --- fs/btrfs/props.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c index 6f52e3d21012

[PATCH 2/5] btrfs: kill __btrfs_set_prop()

2019-02-07 Thread Anand Jain
argument. Signed-off-by: Anand Jain --- fs/btrfs/ioctl.c | 10 ++ fs/btrfs/props.c | 22 +- fs/btrfs/props.h | 6 ++ fs/btrfs/xattr.c | 2 +- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3f9d7be30bf4

[PATCH 1/5] btrfs: fix comment its device list mutex not volume lock

2019-02-07 Thread Anand Jain
We have killed volume mutex (commit: dccdb07bc996 btrfs: kill btrfs_fs_info::volume_mutex) update comment. This a trival one seems to have escaped. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs

[PATCH 5/5] btrfs: trivial, fix c coding style

2019-02-07 Thread Anand Jain
Signed-off-by: Anand Jain --- fs/btrfs/props.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c index 77a03076b18e..3c15f19bfd2f 100644 --- a/fs/btrfs/props.c +++ b/fs/btrfs/props.c @@ -70,8 +70,8 @@ int btrfs_set_prop

[PATCH 0/5] Misc props.c cleanups

2019-02-07 Thread Anand Jain
While adding the readmirror property found few cleanup things which can be fixed. As these aren't part of upcoming readmirror property I am sending these separately. Except for 1/5 rest fixes are in props.c. 1/5 is in volume.c. Anand Jain (5): btrfs: fix comment its device list mutex not v

Re: [PATCH 1/5] btrfs: fix comment its device list mutex not volume lock

2019-02-07 Thread Anand Jain
On 2/8/19 3:07 PM, Nikolay Borisov wrote: On 8.02.19 г. 9:02 ч., Anand Jain wrote: We have killed volume mutex (commit: dccdb07bc996 btrfs: kill btrfs_fs_info::volume_mutex) update comment. This a trival one seems to have escaped. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 2

Re: [PATCH 0/5] Misc props.c cleanups

2019-02-07 Thread Anand Jain
On 2/8/19 3:15 PM, Nikolay Borisov wrote: On 8.02.19 г. 9:02 ч., Anand Jain wrote: While adding the readmirror property found few cleanup things which can be fixed. As these aren't part of upcoming readmirror property I am sending these separately. Except for 1/5 rest fixes are in pr

[PATCH v2 1/5] btrfs: fix comment its device list mutex not volume lock

2019-02-07 Thread Anand Jain
We have killed volume mutex (commit: dccdb07bc996 btrfs: kill btrfs_fs_info::volume_mutex). This a trival one seems to have escaped. Signed-off-by: Anand Jain --- v2: Delete the wrong comment instead of fixing it. fs/btrfs/volumes.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs

Re: [PATCH v4 0/3] btrfs: scrub: fix scrub_lock

2019-02-11 Thread Anand Jain
On 2/9/19 1:02 AM, David Sterba wrote: On Wed, Jan 30, 2019 at 02:44:59PM +0800, Anand Jain wrote: Fixes the circular locking dependency warning as in patch 1/3, and patch 2/3 adds lockdep_assert_held() to scrub_workers_get(). Patch 3/3 converts scrub_workers_refcnt into refcount_t. Anand

[PATCH v5 3/3] btrfs: scrub: convert scrub_workers_refcnt to refcount_t

2019-02-11 Thread Anand Jain
Use the refcount_t for fs_info::scrub_workers_refcnt instead of int. Signed-off-by: Anand Jain --- v5: Fix refcount validation warning. Use refcount_set() instead of refcount_inc() when count is 0. v4: born fs/btrfs/ctree.h | 2 +- fs/btrfs/disk-io.c | 2 +- fs/btrfs/scrub.c | 10

Re: btrfs as / filesystem in RAID1

2019-02-11 Thread Anand Jain
On 2/7/19 7:04 PM, Stefan K wrote: Thanks, with degraded as kernel parameter and also ind the fstab it works like expected That should be the normal behaviour, IMO in the long term it will be. But before that we have few items to fix around this, such as the serviceability part. -Anan

[PATCH v3 0/3] Misc props.c cleanups

2019-02-11 Thread Anand Jain
v3: Merge patch 2/5 and 3/5 as in v1. Not included 1/5 in v1 as its already integrated in misc-next. While adding the readmirror property found few cleanup things which can be fixed. As these aren't part of upcoming readmirror property I am sending these separately. Anand Jain (3):

[PATCH v3 2/3] btrfs: drop redundant forward declaration in props.c

2019-02-11 Thread Anand Jain
functional changes. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov --- v3: merge with 2/5 and 3/5 as in v1 v2: none fs/btrfs/props.c | 163 +++ 1 file changed, 79 insertions(+), 84 deletions(-) diff --git a/fs/btrfs/props.c b/fs/btrfs

[PATCH v3 1/3] btrfs: kill __btrfs_set_prop()

2019-02-11 Thread Anand Jain
argument. Signed-off-by: Anand Jain --- v3: none v2: none fs/btrfs/ioctl.c | 10 ++ fs/btrfs/props.c | 22 +- fs/btrfs/props.h | 6 ++ fs/btrfs/xattr.c | 2 +- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c

[PATCH v3 3/3] btrfs: trivial, fix c coding style

2019-02-11 Thread Anand Jain
Maintain the lines extented upto 80 char where possible, and indent the argument. Signed-off-by: Anand Jain --- v3: changelog added. fs/btrfs/props.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c index 77a03076b18e

Re: [PATCH] btrfs: scrub: add assertions for worker pointers

2019-02-13 Thread Anand Jain
On 2/13/19 1:15 AM, David Sterba wrote: The scrub worker pointers are not NULL iff the scrub is running, so reset them back once the last reference is dropped. Add assertions to the initial phase of scrub to verify that. makes sense. Signed-off-by: David Sterba Reviewed-by: Anand Jain

Re: [PATCH v4 1/3] btrfs: scrub: fix circular locking dependency warning

2019-02-13 Thread Anand Jain
On 2/13/19 12:45 AM, David Sterba wrote: On Wed, Jan 30, 2019 at 02:45:00PM +0800, Anand Jain wrote: Circular locking dependency check reports warning[1], that's because the btrfs_scrub_dev() calls the stack #0 below with, the fs_info::scrub_lock held. The test case leading to this wa

Re: [PATCH] btrfs: scrub: remove unused nocow worker pointer

2019-02-14 Thread Anand Jain
On 2/13/19 1:23 AM, David Sterba wrote: The member btrfs_fs_info::scrub_nocow_workers is unused since the nocow optimization was removed from scrub in 9bebe665c3e4 ("btrfs: scrub: Remove unused copy_nocow_pages and its callchain"). Signed-off-by: David Sterba Reviewed-by:

[PATCH v7 RESEND Rebased] btrfs-progs: dump-tree: add noscan option

2019-06-26 Thread Anand Jain
From: Anand Jain The cli 'btrfs inspect dump-tree ' will scan for the partner devices if any by default. So as of now you can not inspect each mirrored device independently. This patch adds noscan option, which when used won't scan the system for the partner devices, instead i

[PATCH 3/3 RESEND Rebased] btrfs: add readmirror devid property

2019-06-26 Thread Anand Jain
now readmirror by devid supports only raid1s. Raid10 support has to leverage device grouping feature, which is yet to be implemented. Signed-off-by: Anand Jain --- fs/btrfs/props.c | 69 +- fs/btrfs/volumes.c | 16 +++ fs/btrfs/volumes.h | 2

[PATCH 0/3 RESEND Rebased] readmirror feature

2019-06-26 Thread Anand Jain
et the readmirror policy falls back to pid. Drops the mount -o readmirror idea, it can be added at a later point of time. Property now accepts more than 1 devid as readmirror device. As shown in the example above. Anand Jain (3): btrfs: add inode pointer to prop_handler::validate(

[PATCH 2/3 RESEND Rebased] btrfs: add readmirror property framework

2019-06-26 Thread Anand Jain
Function call chain __btrfs_map_block()->find_live_mirror() uses thread %pid to determine the %mirror_num for the read when mirror_num=0 in the argument. This patch introduces a framework so that readmirror is a configurable parameter, with default set to pid. Signed-off-by: Anand Jain ---

[PATCH 1/3 RESEND Rebased] btrfs: add inode pointer to prop_handler::validate()

2019-06-26 Thread Anand Jain
In preparation to add the readmirror property, pass inode in the prop_handler::validate() function vector, so that it can fetch corresponding fs_devices. Signed-off-by: Anand Jain --- fs/btrfs/props.c | 12 +++- fs/btrfs/props.h | 4 ++-- fs/btrfs/xattr.c | 2 +- 3 files changed, 10

[PATCH 2/2 RESEND Rebased] btrfs-progs: add readmirror policy

2019-06-26 Thread Anand Jain
This sets the readmirror= as a btrfs. extentded attribute. Signed-off-by: Anand Jain --- props.c | 49 + 1 file changed, 49 insertions(+) diff --git a/props.c b/props.c index 3a498bd9e904..1d1a2c7f9d14 100644 --- a/props.c +++ b/props.c @@ -178,6

[PATCH 1/2 RESEND Rebased] btrfs-progs: add helper to create xattr name

2019-06-26 Thread Anand Jain
This is a preparatory patch to add more xattr attributes, care a helper function to alloc xattr name. Signed-off-by: Anand Jain --- props.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/props.c b/props.c index efa11180d4c5..3a498bd9e904 100644

[PATCH] btrfs_progs: mkfs: match devid order to the stripe index

2019-06-27 Thread Anand Jain
abc88fa-f42e-4f0c-9bc3-2225735e51d1 stripe 1 devid 2 offset 277872640 dev_uuid 73746d27-13a6-4d58-ac6b-48c90c31d94d Signed-off-by: Anand Jain --- volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/volumes.c b/volum

Re: [PATCH 1/2] btrfs: inode: Don't compress if NODATASUM or NODATACOW set

2019-06-27 Thread Anand Jain
On 27/6/19 10:58 PM, David Sterba wrote: On Tue, Jun 25, 2019 at 04:24:57PM +0800, Qu Wenruo wrote: Ping? This patch should fix the problem of compressed extent even when nodatasum is set. It has been one year but we still didn't get a conclusion on where force_compress should behave. Note t

Re: [PATCH] btrfs_progs: mkfs: match devid order to the stripe index

2019-06-27 Thread Anand Jain
On 28/6/19 10:44 AM, Qu Wenruo wrote: On 2019/6/28 上午10:26, Anand Jain wrote: At the time mkfs.btrfs the device id and stripe index gets reversed as shown in [1]. This patch helps to keep them in order at the time of mkfs.btrfs. And makes it easier to debug. Before: Stripe 0 is on devid 2

Re: [PATCH 09/19] btrfs: limit super block locations in HMZONED mode

2019-06-27 Thread Anand Jain
On 7/6/19 9:10 PM, Naohiro Aota wrote: When in HMZONED mode, make sure that device super blocks are located in randomly writable zones of zoned block devices. That is, do not write super blocks in sequential write required zones of host-managed zoned block devices as update would not be possible.

Re: [PATCH 09/19] btrfs: limit super block locations in HMZONED mode

2019-06-27 Thread Anand Jain
> On 28 Jun 2019, at 2:39 PM, Naohiro Aota wrote: > > On 2019/06/28 12:56, Anand Jain wrote: >> On 7/6/19 9:10 PM, Naohiro Aota wrote: >>> When in HMZONED mode, make sure that device super blocks are located in >>> randomly writable zones of zoned block dev

Re: [PATCH 1/2] btrfs: inode: Don't compress if NODATASUM or NODATACOW set

2019-06-27 Thread Anand Jain
> On 28 Jun 2019, at 1:58 PM, Qu Wenruo wrote: > > > > On 2019/6/28 上午10:47, Anand Jain wrote: >> On 27/6/19 10:58 PM, David Sterba wrote: >>> On Tue, Jun 25, 2019 at 04:24:57PM +0800, Qu Wenruo wrote: >>>> Ping? >>>> >>>>

Re: [PATCH 2/2] btrfs: Move free_pages_out label in inline extent handling branch in compress_file_range

2019-07-01 Thread Anand Jain
On 2/7/19 12:50 AM, Nikolay Borisov wrote: This label is only executed if compress_file_range fails to create an inline extent. So move its code in the semantically related inline extent handling branch. No functional changes. Signed-off-by: Nikolay Borisov Looks good. Reviewed-by: Anand

Re: [PATCH 1/2] btrfs: Return number of compressed extents directly in compress_file_range

2019-07-01 Thread Anand Jain
Signed-off-by: Nikolay Borisov Looks good. Reviewed-by: Anand Jain --- fs/btrfs/inode.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4e183c2d3555..3b0bf5ea9eb6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs

Re: [PATCH 0/3 RESEND Rebased] readmirror feature

2019-07-02 Thread Anand Jain
Ping? On 26/6/19 4:33 PM, Anand Jain wrote: These patches are tested to be working fine. Function call chain __btrfs_map_block()->find_live_mirror() uses thread pid to determine the %mirror_num when the mirror_num=0. This patch introduces a framework so that we can add policies to determ

Re: [PATCH v7 RESEND Rebased] btrfs-progs: dump-tree: add noscan option

2019-07-02 Thread Anand Jain
Ping? On 26/6/19 4:30 PM, Anand Jain wrote: From: Anand Jain The cli 'btrfs inspect dump-tree ' will scan for the partner devices if any by default. So as of now you can not inspect each mirrored device independently. This patch adds noscan option, which when used won't

Re: [PATCH][next] btrfs: fix memory leak of path on error return path

2019-07-02 Thread Anand Jain
. Addresses-Coverity: ("Resource leak") Fixes: 5911c8fe05c5 ("btrfs: fiemap: preallocate ulists for btrfs_check_shared") Signed-off-by: Colin Ian King Reviewed-by: Anand Jain --- fs/btrfs/extent_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/extent_io.c b/

Re: [PATCH v7 RESEND Rebased] btrfs-progs: dump-tree: add noscan option

2019-07-03 Thread Anand Jain
> On 4 Jul 2019, at 12:09 AM, David Sterba wrote: > > On Wed, Jun 26, 2019 at 01:30:17AM -0700, Anand Jain wrote: >> From: Anand Jain >> >> The cli 'btrfs inspect dump-tree ' will scan for the partner devices >> if any by default. >> >>

Re: [PATCH v7 RESEND Rebased] btrfs-progs: dump-tree: add noscan option

2019-07-03 Thread Anand Jain
> On 4 Jul 2019, at 7:39 AM, David Sterba wrote: > > On Thu, Jul 04, 2019 at 06:16:54AM +0800, Anand Jain wrote: >> >> >>> On 4 Jul 2019, at 12:09 AM, David Sterba wrote: >>> >>> On Wed, Jun 26, 2019 at 01:30:17AM -0700, Anand Jain wrote:

Re: [PATCH v2 00/14] btrfs-progs: image: Enhance and bug fixes

2019-07-03 Thread Anand Jain
On 2/7/19 6:07 PM, WenRuo Qu wrote: This patchset is based on v5.1.1 tag. With this update, the patchset has the following features: - various small fixes and enhancements for btrfs-image * Fix an indent misalign * Fix an access-beyond-boundary bug * Fix a confusing error message due to

Re: [PATCH][next] btrfs: fix memory leak of path on error return path

2019-07-04 Thread Anand Jain
On 5/7/19 12:37 AM, David Sterba wrote: On Tue, Jul 02, 2019 at 03:10:28PM +0100, Colin King wrote: From: Colin Ian King Currently if the allocation of roots or tmp_ulist fails the error handling does not free up the allocation of path causing a memory leak. Fix this by freeing path with a cal

Re: [PATCH][next][V2] btrfs: fix memory leak of path on error return path

2019-07-04 Thread Anand Jain
On 5/7/19 7:03 AM, Colin King wrote: From: Colin Ian King Currently if the allocation of roots or tmp_ulist fails the error handling does not free up the allocation of path causing a memory leak. Fix this and other similar leaks by moving the call of btrfs_free_path from label out to label out_

Re: "btrfs: harden agaist duplicate fsid" spams syslog

2019-07-10 Thread Anand Jain
Right. It happened even without this patch but we just know it now. In the original investigations of the patch, the moment you copy a device image into another device, the autoscan would scan the new device into the btrfs kernel and created a mess. Now with this patch we won't replace the device

Re: "btrfs: harden agaist duplicate fsid" spams syslog

2019-07-12 Thread Anand Jain
that is calling 'btrfs dev scan' every ~2mins or trying to mount an unmounted device without understanding that its mapper is already mounted. Thanks, Anand On 12/7/19 2:00 AM, Graham Cobb wrote: On 11/07/2019 03:46, Anand Jain wrote: Now the question I am trying to understand, why

Re: "btrfs: harden agaist duplicate fsid" spams syslog

2019-07-12 Thread Anand Jain
On 12/7/19 7:06 AM, Christoph Anton Mitterer wrote: I'm also seeing these since quite a while on Debian sid: Jul 11 13:33:56 heisenberg kernel: BTRFS info (device dm-0): device fsid 60[...]3c devid 1 moved old:/dev/mapper/system new:/dev/dm-0 Jul 11 13:33:56 heisenberg kernel: BTRFS info (devic

Re: [PATCH v2.1 08/10] btrfs-progs: image: Introduce -d option to dump data

2019-07-14 Thread Anand Jain
+ if (dump_data && walk_trees) { + error("-d conflicts with -f option"); should be ..with -w option Thanks, Anand

Re: [PATCH v2.1 08/10] btrfs-progs: image: Introduce -d option to dump data

2019-07-14 Thread Anand Jain
On 4/7/19 2:11 PM, Qu Wenruo wrote: static int copy_from_extent_tree(struct metadump_struct *metadump, -struct btrfs_path *path) +struct btrfs_path *path, bool dump_data) { struct btrfs_root *extent_root; struc

[PATCH] btrfs-progs: add verbose option to btrfs device scan

2019-07-15 Thread Anand Jain
To help debug device scan issues, add verbose option to btrfs device scan. Signed-off-by: Anand Jain --- cmds/device.c| 8 ++-- cmds/filesystem.c| 2 +- common/device-scan.c | 4 +++- common/device-scan.h | 2 +- common/utils.c | 2 +- disk-io.c| 2 +- 6 files

Re: [PATCH] btrfs-progs: add verbose option to btrfs device scan

2019-07-15 Thread Anand Jain
> On 15 Jul 2019, at 11:09 PM, Nikolay Borisov wrote: > > > > On 15.07.19 г. 17:42 ч., Anand Jain wrote: >> To help debug device scan issues, add verbose option to btrfs device scan. >> >> Signed-off-by: Anand Jain > > I fail to see what this pa

Re: [PATCH] btrfs-progs: add verbose option to btrfs device scan

2019-07-15 Thread Anand Jain
> On 16 Jul 2019, at 9:26 AM, Qu Wenruo wrote: > > > > On 2019/7/15 下午11:09, Nikolay Borisov wrote: >> >> >> On 15.07.19 г. 17:42 ч., Anand Jain wrote: >>> To help debug device scan issues, add verbose option to btrfs device scan. >>>

[PATCH v2] btrfs-progs: add verbose option to btrfs device scan

2019-07-15 Thread Anand Jain
To help debug device scan issues, add verbose option to btrfs device scan. Signed-off-by: Anand Jain --- v2: Use bool instead of int as a btrfs_scan_device() argument. cmds/device.c| 8 ++-- cmds/filesystem.c| 2 +- common/device-scan.c | 4 +++- common/device-scan.h | 3

Re: [PATCH] btrfs-progs: add verbose option to btrfs device scan

2019-07-16 Thread Anand Jain
> On 16 Jul 2019, at 2:46 PM, Nikolay Borisov wrote: > > > > On 16.07.19 г. 4:26 ч., Qu Wenruo wrote: >> >> >> On 2019/7/15 下午11:09, Nikolay Borisov wrote: >>> >>> >>> On 15.07.19 г. 17:42 ч., Anand Jain wrote: >>>&

[PATCH] btrfs: ratelimit device path change info on mounted device

2019-07-16 Thread Anand Jain
fsid 4d1ba5af-8b89-4cb5-96c6-55d1f028a202 devid 4 moved old:/dev/dm-13 new:/dev/mapper/cryptdata4tb--vg-backup Fix this by using the ratelimit printk. Signed-off-by: Anand Jain Reported-by: g.bt...@cobb.uk.net Reported-by: cales...@scientia.net --- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 inse

Re: [PATCH] btrfs: ratelimit device path change info on mounted device

2019-07-16 Thread Anand Jain
Graham, Chris, I am unable to reproduce, would you be able to try this patch and let me know if this fixes the problem? Thanks, Anand On 16/7/19 9:59 PM, Anand Jain wrote: If there are more than one path to a device, the last scanned path will map to the mounted FS. In some Linux based

Re: [PATCH 0/3 RESEND Rebased] readmirror feature

2019-07-23 Thread Anand Jain
> On 24 Jul 2019, at 8:20 AM, Qu Wenruo wrote: > > > > On 2019/6/26 下午4:33, Anand Jain wrote: >> These patches are tested to be working fine. >> >> Function call chain __btrfs_map_block()->find_live_mirror() uses >> thread pid to deter

Re: [PATCH 2/3 RESEND Rebased] btrfs: add readmirror property framework

2019-07-23 Thread Anand Jain
> On 23 Jul 2019, at 10:57 PM, David Sterba wrote: > > On Wed, Jun 26, 2019 at 04:34:01PM +0800, Anand Jain wrote: >> Function call chain __btrfs_map_block()->find_live_mirror() uses >> thread %pid to determine the %mirror_num for the read when mirror_num=0 >>

Re: [PATCH 2/2 RESEND Rebased] btrfs-progs: add readmirror policy

2019-07-23 Thread Anand Jain
On 23/7/19 9:53 PM, David Sterba wrote: On Wed, Jun 26, 2019 at 04:37:23PM +0800, Anand Jain wrote: This sets the readmirror= as a btrfs. extentded attribute. Signed-off-by: Anand Jain --- props.c | 49 + 1 file changed, 49 insertions

Re: Massive filesystem corruption since kernel 5.2 (ARCH)

2019-07-31 Thread Anand Jain
On 29/7/19 10:04 PM, Swâmi Petaramesh wrote: On 7/29/19 3:58 PM, Lionel Bouton wrote: For example I suspected that your SSD is a SATA one and I remember data corruption bugs where the root cause was wrong assumptions made between the filesystem layer and the io scheduler. As NVMe devices trigger

Re: Massive filesystem corruption since kernel 5.2 (ARCH)

2019-08-01 Thread Anand Jain
> On 1 Aug 2019, at 4:43 PM, Qu Wenruo wrote: > > > > On 2019/8/1 下午4:07, Swâmi Petaramesh wrote: >> On 8/1/19 8:36 AM, Qu Wenruo wrote: >>> Could you give more detailed history, including each reboot? >>> Like: >>> >>> CASE 1 >>> # Upgrade kernel (running 5.1) >>> # Reboot >>> # Kernel mou

Re: [PATCH 1/2] btrfs: remove unused btrfs_device::flush_bio_sent

2019-08-01 Thread Anand Jain
On 8/2/19 1:53 AM, David Sterba wrote: The status of flush bio is tracked as a status bit, changed in commit 1c3063b6dbfa ("btrfs: cleanup device states define BTRFS_DEV_STATE_FLUSH_SENT"), the flush_bio_sent was forgotten. Signed-off-by: David Sterba oops my bad. Reviewed-by: Anand Jain

Re: [PATCH 2/2] btrfs: remove unused key type set/get helpers

2019-08-01 Thread Anand Jain
On 8/2/19 1:53 AM, David Sterba wrote: The switch to open coded set/get has happend long time ago in 962a298f3511 ("btrfs: kill the key type accessor helpers"), remove the stray helpers. Signed-off-by: David Sterba Reviewed-by: Anand Jain

Re: [PATCH 3/3] btrfs: tree-log: use symbolic name for first replay stage

2019-08-01 Thread Anand Jain
For whole series. Reviewed-by: Anand Jain One nit below. On 8/1/19 8:50 PM, David Sterba wrote: Signed-off-by: David Sterba --- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 5513e76cc336

Re: [RFC] BTRFS_DEV_REPLACE_ITEM_STATE_* doesn't match with on disk

2019-08-01 Thread Anand Jain
Ping. On 11/21/18 3:31 PM, Anand Jain wrote: David, any comments on this please. Thanks, Anand On 11/13/2018 06:32 PM, Anand Jain wrote: David, Gentle ping. Thanks, Anand On 11/12/2018 03:50 PM, Nikolay Borisov wrote: On 12.11.18 г. 6:58 ч., Anand Jain wrote: The

Re: The btrfs 'label' property: device or filesystem-wide?

2019-08-02 Thread Anand Jain
On 8/2/19 5:42 PM, Hans van Kranenburg wrote: Hi, I was just looking at btrfs property and what it can do. Now, I notice that the man page contains: label: label of device When I look at a device and ask what properties I can set, I see: -# btrfs property list -t device /dev/xvdb label

Re: [PATCH 0/2] Sysfs updates

2019-08-06 Thread Anand Jain
gging exports btrfs: delete debugfs code fs/btrfs/sysfs.c | 68 +++- fs/btrfs/sysfs.h | 5 2 files changed, 32 insertions(+), 41 deletions(-) For 2/2: Reviewed-by: Anand Jain For 1/2: IMO it would be better to delay this until we really h

<    1   2   3   4   5   6   7   8   9   10   >