[PATCH 2/5] btrfs: set the total_devices in device_list_add()

2018-01-09 Thread Anand Jain
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 6 ++ 1 file changed

[PATCH 3/5] btrfs: get device pointer from device_list_add()

2018-01-09 Thread Anand Jain
Instead of pointer to btrfs_fs_devices from device_list_add() its better to get pointer to btrfs_device, then we have both, pointer to btrfs_device and btrfs_fs_devices. This is needed in preparation to add handling reappearing missing device feature. Signed-off-by: Anand Jain --- fs/btrfs

[PATCH 0/5] device_list_add() peparation to add reappearing missing device

2018-01-09 Thread Anand Jain
Cleanup of device_list_add(), mainly in preparation to handle reappearing missing device which its next reroll will be sent separately. Anand Jain (5): btrfs: move pr_info into device_list_add btrfs: set the total_devices in device_list_add() btrfs: get device pointer from device_list_add

[PATCH 5/5] btrfs: move uuid_mutex closer to exclusivity

2018-01-09 Thread Anand Jain
move uuid_mutex with in device_list_add(). Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f942e8193862..283417bf3b00 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c

Re: [PATCH 3/5] btrfs: get device pointer from device_list_add()

2018-01-09 Thread Anand Jain
On 01/10/2018 12:13 AM, Josef Bacik wrote: On Tue, Jan 09, 2018 at 10:46:23PM +0800, Anand Jain wrote: Instead of pointer to btrfs_fs_devices from device_list_add() its better to get pointer to btrfs_device, then we have both, pointer to btrfs_device and btrfs_fs_devices. This is needed in

Re: [PATCH 5/5] btrfs: move uuid_mutex closer to exclusivity

2018-01-09 Thread Anand Jain
On 01/10/2018 12:15 AM, Josef Bacik wrote: On Tue, Jan 09, 2018 at 10:46:25PM +0800, Anand Jain wrote: move uuid_mutex with in device_list_add(). Signed-off-by: Anand Jain This isn't going to work, there's a bunch of places we return errors so this just deadlocks the box. Lea

[PATCH 1/4] btrfs: move pr_info into device_list_add

2018-01-09 Thread Anand Jain
Commit 60999ca4b403 ("btrfs: make device scan less noisy") adds return value 1 to device_list_add(), so that parent function can call pr_info only when new device is added. Move the pr_info() part into device_list_add() so that this function can be kept simple. Signed-off-by: Anand Jain

[PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-09 Thread Anand Jain
Instead of pointer to btrfs_fs_devices as an arg in device_list_add() better to get pointer to btrfs_device as return value, then we have both, pointer to btrfs_device and btrfs_fs_devices. btrfs_device is needed to handle reappearing missing device. Signed-off-by: Anand Jain --- fs/btrfs

[PATCH 4/4] btrfs: drop devid as device_list_add() arg

2018-01-09 Thread Anand Jain
As struct btrfs_disk_super is being passed, so it can get devid the same way its parent does. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH V2 0/4] device_list_add() peparation to add reappearing missing device

2018-01-09 Thread Anand Jain
v1->v2: Drop patch 5/5 for uuid_mutex optimize. That was wrong. Thanks Josef. In patch 3/5 make btrfs_device * as return. Cleanup of device_list_add(), mainly in preparation to handle reappearing missing device which its next reroll will be sent separately. Anand Jain (4): btrfs: m

[PATCH 2/4] btrfs: set the total_devices in device_list_add()

2018-01-09 Thread Anand Jain
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c

[PATCH 3/6] btrfs: make btrfs_free_stale_device() to iterate all stales

2018-01-09 Thread Anand Jain
From: Anand Jain Let the list iterator iterate further and find other stale devices and delete it. This is in preparation to add support for user land request-able stale devices cleanup. Also rename btrfs_free_stale_device() to btrfs_free_stale_devices(). Signed-off-by: Anand Jain --- fs

[PATCH 1/6] btrfs: cleanup btrfs_free_stale_device() usage

2018-01-09 Thread Anand Jain
We call btrfs_free_stale_device() only when we alloc a new struct btrfs_device (ret=1), so move it closer to where we alloc the new device. Also drop the comments. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +--- 1 file changed, 1 insertion(+), 7

[PATCH 4/6] btrfs: make btrfs_free_stale_device() argument optional

2018-01-09 Thread Anand Jain
From: Anand Jain This updates btrfs_free_stale_device() helper function to delete all unmouted devices, when arg is NULL. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c

[PATCH 2/6] btrfs: no need to check for btrfs_fs_devices::seeding

2018-01-09 Thread Anand Jain
There is no need to check for btrfs_fs_devices::seeding when we have checked for btrfs_fs_devices::opened, because we can't sprout without its seed FS being opened. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 2 -- 1 file changed, 2 deletions(-) diff --git

[PATCH 2/4] btrfs: set the total_devices in device_list_add()

2018-01-09 Thread Anand Jain
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c

[PATCH 5/6] btrfs: rename btrfs_free_stale_devices() arg to skip_dev

2018-01-09 Thread Anand Jain
No functional changes. Rename btrfs_free_stale_devices() arg to skip_dev, so that it reflects what that arg for. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH v3 0/4] device_list_add() peparation to add reappearing missing device

2018-01-09 Thread Anand Jain
tch 5/5 for uuid_mutex optimize. That was wrong. Thanks Josef. In patch 3/5 make btrfs_device * as return. Cleanup of device_list_add(), mainly in preparation to handle reappearing missing device which its next reroll will be sent separately. Anand Jain (4): btrfs: move pr_info into device_list_

[PATCH 1/4] btrfs: move pr_info into device_list_add

2018-01-09 Thread Anand Jain
Commit 60999ca4b403 ("btrfs: make device scan less noisy") adds return value 1 to device_list_add(), so that parent function can call pr_info only when new device is added. Move the pr_info() part into device_list_add() so that this function can be kept simple. Signed-off-by: Anand Jain

[PATCH 4/4] btrfs: drop devid as device_list_add() arg

2018-01-09 Thread Anand Jain
As struct btrfs_disk_super is being passed, so it can get devid the same way its parent does. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-09 Thread Anand Jain
Instead of pointer to btrfs_fs_devices as an arg in device_list_add() better to get pointer to btrfs_device as return value, then we have both, pointer to btrfs_device and btrfs_fs_devices. btrfs_device is needed to handle reappearing missing device. Signed-off-by: Anand Jain --- fs/btrfs

[PATCH v4 0/6] preparatory work to add device forget

2018-01-09 Thread Anand Jain
ice() to add feature to forget a scanned device or all stale devices. So this patch set proposes following changes to it. Anand Jain (6): btrfs: cleanup btrfs_free_stale_device() usage btrfs: no need to check for btrfs_fs_devices::seeding btrfs: make btrfs_free_stale_device() to iterate all st

[PATCH 6/6] btrfs: make btrfs_free_stale_device() to match the path

2018-01-09 Thread Anand Jain
From: Anand Jain The btrfs_free_stale_device() is updated to match for the given device path and delete it. (It searches for only unmounted list of devices.) Also drop the comment about different path being used for the same device, since now we will have cli to clean any device that's

Re: [PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-10 Thread Anand Jain
@@ -742,7 +741,7 @@ static noinline int device_list_add(const char *path, if (!fs_devices) { fs_devices = alloc_fs_devices(disk_super->fsid); if (IS_ERR(fs_devices)) - return PTR_ERR(fs_devices); + return ERR_PT

[PATCH v4 0/4] device_list_add() peparation to add reappearing missing device

2018-01-10 Thread Anand Jain
l will be sent separately. Anand Jain (4): btrfs: move pr_info into device_list_add btrfs: set the total_devices in device_list_add() btrfs: get device pointer from device_list_add() btrfs: drop devid as device_list_add() arg fs/btrfs/volumes.c | 63 +++-

[PATCH 2/4] btrfs: set the total_devices in device_list_add()

2018-01-10 Thread Anand Jain
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c

[PATCH 4/4] btrfs: drop devid as device_list_add() arg

2018-01-10 Thread Anand Jain
As struct btrfs_disk_super is being passed, so it can get devid the same way its parent does. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH 1/4] btrfs: move pr_info into device_list_add

2018-01-10 Thread Anand Jain
Commit 60999ca4b403 ("btrfs: make device scan less noisy") adds return value 1 to device_list_add(), so that parent function can call pr_info only when new device is added. Move the pr_info() part into device_list_add() so that this function can be kept simple. Signed-off-by: Anand Jain

[PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-10 Thread Anand Jain
Instead of pointer to btrfs_fs_devices as an arg in device_list_add() better to get pointer to btrfs_device as return value, then we have both, pointer to btrfs_device and btrfs_fs_devices. btrfs_device is needed to handle reappearing missing device. Signed-off-by: Anand Jain --- fs/btrfs

[PATCH 1/1] btrfs: introduce feature to forget a btrfs device

2018-01-10 Thread Anand Jain
the kernel using the BTRFS_DEVICE_SPEC_ALL_DEV flag. Remove all devices functionality would override remove one device when both are specified in an IOCTL call. Again, the devices are removed only if the relevant fsid aren't mounted. Signed-off-by: Anand Jain --- fs/btrfs/super.c | 27

[PATCH v6] Add cli and ioctl to forget scanned device(s)

2018-01-10 Thread Anand Jain
ATCH 1/2] btrfs: refactor btrfs_free_stale_device() to get device list delete to [PATCH 1/2] btrfs: add function to device list delete Adds cli and ioctl to forget a scanned device or forget all stale devices in the kernel. Anand Jain (1): btrfs: introduce feature to forget a btrfs de

[PATCH 1/1] btrfs-progs: add cli to forget one or all scanned devices

2018-01-10 Thread Anand Jain
This patch adds cli btrfs device forget [dev] which shall remove the relevant device entries in the kernel matching the dev. If no argument is given it shall remove all stale (device which are not mounted) from the kernel. Signed-off-by: Anand Jain --- cmds-device.c | 77

Re: [PATCH v4 2/4] btrfs: cleanup btrfs_mount() using btrfs_mount_root()

2018-01-12 Thread Anand Jain
Misono, This change is causing subsequent (subvol) mount to fail when device option is specified. The simplest eg for failure is .. mkfs.btrfs -qf /dev/sdc /dev/sdb mount -o device=/dev/sdb /dev/sdc /btrfs mount -o device=/dev/sdb /dev/sdc /btrfs1 mount: /dev/sdc is already moun

Re: [PATCH v4 2/4] btrfs: cleanup btrfs_mount() using btrfs_mount_root()

2018-01-16 Thread Anand Jain
On 01/16/2018 03:26 AM, David Sterba wrote: On Fri, Jan 12, 2018 at 06:14:40PM +0800, Anand Jain wrote: Misono, This change is causing subsequent (subvol) mount to fail when device option is specified. The simplest eg for failure is .. mkfs.btrfs -qf /dev/sdc /dev/sdb mount

[PATCH 1/2] btrfs: fix device order consistency

2018-01-17 Thread Anand Jain
By maintaining the device order consistency it makes reproducing the problem more consistent. So fix this by having the devices sorted by some order within the kernel, lets say by devid. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 16 1 file changed, 16 insertions

[PATCH 2/2] btrfs: fix alloc device order consistency

2018-01-17 Thread Anand Jain
Add opened device to the tail of dev_alloc_list so that it maintains the same order as dev_list. 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/volumes.c index 68be58a5b03f..543c166049e7 100644

[PATCH 0/2] fix device orders consistency

2018-01-17 Thread Anand Jain
By maintaining the device order (some) consistency it makes reproducing the problem more consistent. Anand Jain (2): btrfs: fix device order consistency btrfs: fix alloc device order consistency fs/btrfs/volumes.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion

Re: [lkp-robot] [btrfs] d1f6ad52c3: BTRFS error (device md0): SUPER_FLAG_CHANGING_FSID is set

2018-01-17 Thread Anand Jain
: d1f6ad52c3f93a9da45e11001e0a0be8f3c31e9e ("btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko") url: https://github.com/0day-ci/linux/commits/Anand-Jain/btrfs-add-missing-BTRFS_SUPER_FLAG-define/20180109-041023 base: https://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git next i

Re: [PATCH v4 2/4] btrfs: cleanup btrfs_mount() using btrfs_mount_root()

2018-01-17 Thread Anand Jain
On 01/17/2018 04:30 PM, Misono, Tomohiro wrote: On 2018/01/16 20:45, Anand Jain wrote: On 01/16/2018 03:26 AM, David Sterba wrote: On Fri, Jan 12, 2018 at 06:14:40PM +0800, Anand Jain wrote: Misono, This change is causing subsequent (subvol) mount to fail when device option is

Re: [PATCH 1/2] btrfs: fix the bug of device scan/ready for mounted, filesystem

2018-01-17 Thread Anand Jain
fs_scan_one_device() in the path of device ready/scan ioctl. Reviewed-by: Anand Jain Thanks, Anand Signed-off-by: Tomohiro Misono --- fs/btrfs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9438d32c4267..6ff13

Re: [PATCH 1/2] btrfs: fix device order consistency

2018-01-18 Thread Anand Jain
On 01/18/2018 04:32 PM, Nikolay Borisov wrote: On 18.01.2018 04:32, Anand Jain wrote: By maintaining the device order consistency it makes reproducing the problem more consistent. So fix this by having the devices Which problem is that ? I noticed when trying to reproduce raid1 missed

[PATCH 4/6] btrfs: make btrfs_free_stale_devices() argument optional

2018-01-18 Thread Anand Jain
From: Anand Jain This updates btrfs_free_stale_devices() helper function to delete all unmouted devices, when arg is NULL. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/btrfs

[PATCH 3/6] btrfs: make btrfs_free_stale_device() to iterate all stales

2018-01-18 Thread Anand Jain
From: Anand Jain Let the list iterator iterate further and find other stale devices and delete it. This is in preparation to add support for user land request-able stale devices cleanup. Also rename btrfs_free_stale_device() to btrfs_free_stale_devices(). Signed-off-by: Anand Jain Reviewed-by

[PATCH 1/6] btrfs: cleanup btrfs_free_stale_device() usage

2018-01-18 Thread Anand Jain
We call btrfs_free_stale_device() only when we alloc a new struct btrfs_device (ret=1), so move it closer to where we alloc the new device. Also drop the comments. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +--- 1 file changed, 1 insertion(+), 7

[PATCH v5 0/6] preparatory work to add device forget

2018-01-18 Thread Anand Jain
btrfs_device::name is null when we have missing device and unmounted. So we still need to check for dev->name. We can reuse the function btrfs_free_stale_device() to add feature to forget a scanned device or all stale devices. So this patch set proposes following changes to it. Anand Jain (6):

[PATCH 5/6] btrfs: rename btrfs_free_stale_devices() arg to skip_dev

2018-01-18 Thread Anand Jain
No functional changes. Rename btrfs_free_stale_devices() arg to skip_dev, so that it reflects what that arg for. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs

[PATCH 2/6] btrfs: no need to check for btrfs_fs_devices::seeding

2018-01-18 Thread Anand Jain
There is no need to check for btrfs_fs_devices::seeding when we have checked for btrfs_fs_devices::opened, because we can't sprout without its seed FS being opened. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 2 -- 1 file changed, 2 deletions(-) diff --git

[PATCH 6/6] btrfs: make btrfs_free_stale_devices() to match the path

2018-01-18 Thread Anand Jain
From: Anand Jain The btrfs_free_stale_devices() is updated to match for the given device path and delete it. (It searches for only unmounted list of devices.) Also drop the comment about different path being used for the same device, since now we will have cli to clean any device that's

[PATCH RESEND v4 0/4] device_list_add() peparation to add reappearing missing device

2018-01-18 Thread Anand Jain
l will be sent separately. Anand Jain (4): btrfs: move pr_info into device_list_add btrfs: set the total_devices in device_list_add() btrfs: get device pointer from device_list_add() btrfs: drop devid as device_list_add() arg fs/btrfs/volumes.c | 63 +++-

[PATCH 1/4] btrfs: move pr_info into device_list_add

2018-01-18 Thread Anand Jain
Commit 60999ca4b403 ("btrfs: make device scan less noisy") adds return value 1 to device_list_add(), so that parent function can call pr_info only when new device is added. Move the pr_info() part into device_list_add() so that this function can be kept simple. Signed-off-by: Anand Jain

[PATCH 4/4] btrfs: drop devid as device_list_add() arg

2018-01-18 Thread Anand Jain
As struct btrfs_disk_super is being passed, so it can get devid the same way its parent does. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-18 Thread Anand Jain
Instead of pointer to btrfs_fs_devices as an arg in device_list_add() better to get pointer to btrfs_device as return value, then we have both, pointer to btrfs_device and btrfs_fs_devices. btrfs_device is needed to handle reappearing missing device. Signed-off-by: Anand Jain --- fs/btrfs

[PATCH 2/4] btrfs: set the total_devices in device_list_add()

2018-01-18 Thread Anand Jain
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c

Re: [PATCH] Fstests: btrfs/011 fix device mounted when tests aborts

2018-01-18 Thread Anand Jain
cleanup() to umount SCRATCH_MNT by 011 itself. Signed-off-by: Liu Bo Reviewed-by: Anand Jain Tested-by: Anand Jain Thanks, Anand --- tests/btrfs/011 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/btrfs/011 b/tests/btrfs/011 index 28f1388..f4c5309 100755 --- a/tests/btrfs/011

Re: [PATCH 1/3] btrfs: make code easy to read in btrfs_open_one_device()

2018-01-21 Thread Anand Jain
On 01/05/2018 10:09 PM, David Sterba wrote: On Fri, Dec 15, 2017 at 03:40:14PM +0800, Anand Jain wrote: No functional change. First set the usual case, writeable then check for any special config. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 8 +++- 1 file changed, 3 insertions

[PATCH v2 2/2] btrfs: optimize move uuid_mutex closer to the critical section

2018-01-21 Thread Anand Jain
Move uuid_mutex closer to the exclusion section. Signed-off-by: Anand Jain Reviewed-by: David Sterba --- v1->v1: No change. Add received reviewed-by. Thxs. fs/btrfs/volumes.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/bt

[PATCH v2 1/2] btrfs: make code easy to read in btrfs_open_one_device()

2018-01-21 Thread Anand Jain
From: Anand Jain First set the usual case that is writeable, then check for any special case like a seed device or a rdonly device and set the state appropriately. Signed-off-by: Anand Jain --- v1->v2: Add comment and commit log to explain its safe to set writeable first and then reset

[PATCH v2.1 2/2] btrfs: optimize move uuid_mutex closer to the critical section

2018-01-21 Thread Anand Jain
Move uuid_mutex closer to the exclusion section. Signed-off-by: Anand Jain Reviewed-by: David Sterba --- v2->v2.1: updated the v2 reroll log below. v1->v2: Add received reviewed-by. Thxs. Fix conflict on top of kdave misc-next. fs/btrfs/volumes.c | 17 - 1 file chan

[PATCH v2 1/2] btrfs: make code easy to read in btrfs_open_one_device()

2018-01-21 Thread Anand Jain
From: Anand Jain First set the usual case that is writeable, then check for any special case like a seed device or a rdonly device and set the state appropriately. Signed-off-by: Anand Jain --- v1->v2: Add comments, and update change log. fs/btrfs/volumes.c | 14 +- 1 f

Re: [PATCH RESEND v4 0/4] device_list_add() peparation to add reappearing missing device

2018-01-22 Thread Anand Jain
On 01/20/2018 07:27 AM, David Sterba wrote: On Thu, Jan 18, 2018 at 06:47:17PM +0100, David Sterba wrote: On Thu, Jan 18, 2018 at 10:02:32PM +0800, Anand Jain wrote: (Apply on top of my patchset [PATCH v4 0/6] preparatory work to add device forget for conflict free apply. They don&#

[PATCH 1/4] btrfs: move pr_info into device_list_add

2018-01-22 Thread Anand Jain
Commit 60999ca4b403 ("btrfs: make device scan less noisy") adds return value 1 to device_list_add(), so that parent function can call pr_info only when new device is added. Move the pr_info() part into device_list_add() so that this function can be kept simple. Signed-off-by: Anand Jain

[PATCH 3/4] btrfs: get device pointer from device_list_add()

2018-01-22 Thread Anand Jain
Instead of pointer to btrfs_fs_devices as an arg in device_list_add() better to get pointer to btrfs_device as return value, then we have both, pointer to btrfs_device and btrfs_fs_devices. btrfs_device is needed to handle reappearing missing device. Signed-off-by: Anand Jain --- fs/btrfs

[PATCH 2/4] btrfs: set the total_devices in device_list_add()

2018-01-22 Thread Anand Jain
There is no other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c

[PATCH 4/4] btrfs: drop devid as device_list_add() arg

2018-01-22 Thread Anand Jain
As struct btrfs_disk_super is being passed, so it can get devid the same way its parent does. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH v5 0/4] device_list_add() peparation to add reappearing missing device

2018-01-22 Thread Anand Jain
return. Cleanup of device_list_add(), mainly in preparation to handle reappearing missing device which its next reroll will be sent separately. *** BLURB HERE *** Anand Jain (4): btrfs: move pr_info into device_list_add btrfs: set the total_devices in device_list_add() btrfs: get de

Re: [PATCH RESEND v4 0/4] device_list_add() peparation to add reappearing missing device

2018-01-22 Thread Anand Jain
On 01/22/2018 11:26 PM, David Sterba wrote: On Mon, Jan 22, 2018 at 09:31:47PM +0800, Anand Jain wrote: Problem was mainly due to the patch 3/4, which tried to access the return pointer even for the failed condition. The fix is to bring the device point access under the else part as

[PATCH v2 0/2] fix device orders consistency

2018-01-22 Thread Anand Jain
cing the missing chunk related problems more consistent. (More fixes of this sort is coming up). Anand Jain (2): btrfs: fix device order consistency btrfs: fix alloc device order consistency fs/btrfs/volumes.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) -- 2.7.

[PATCH v2 1/2] btrfs: fix device order consistency

2018-01-22 Thread Anand Jain
devices are having and same SB generation. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 16 1 file changed, 16 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 03f2685a5018..98e41d286283 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c

[PATCH v2 2/2] btrfs: fix alloc device order consistency

2018-01-22 Thread Anand Jain
Add opened device to the tail of dev_alloc_list instead of head, so that it maintains the same order as dev_list. 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/volumes.c index 98e41d286283

Re: [PATCH] bytrfs-progs: Print error on invalid extent item format during check

2018-01-24 Thread Anand Jain
nitpick: typo in $subject. Thanks, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH] btrfs: delete function btrfs_close_extra_devices()

2018-01-25 Thread Anand Jain
ned by the __btrfs_open_devices() and is based on the generation number again. So this patch deletes btrfs_close_extra_devices() function and its calls as there is no use of it. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 13 --- fs/btrfs/volu

Re: [PATCH] btrfs: Fix UAF

2018-01-28 Thread Anand Jain
The fix is to use 'break' when we know we are freeing the current fs_devs. No break is needed as we need to iterate all stale devices and delete the found stale entry, so commit [1] used list_for_each_entry_safe() and removed the break, [1] commit 38cf665d338fca33af4b16f9ec7cad6

Re: [PATCH] btrfs: Fix UAF

2018-01-29 Thread Anand Jain
On 01/29/2018 03:01 PM, Nikolay Borisov wrote: On 29.01.2018 04:38, Anand Jain wrote: On 01/26/2018 09:20 PM, Nikolay Borisov wrote: Commit 4fde46f0cc71 ("Btrfs: free the stale device") introduced btrfs_free_stale_device which iterates the device lists for all regist

Re: [PATCH] btrfs: fix err_cast.cocci warnings

2018-01-29 Thread Anand Jain
: scripts/coccinelle/api/err_cast.cocci Fixes: bf155c98d312 ("btrfs: get device pointer from device_list_add()") CC: Anand Jain Signed-off-by: Fengguang Wu Thanks for the fix, I'll fold it to the patch. Oh. I just saw this email thread, err my filters. sorry. Thanks for the fix.

[PATCH 1/2] btrfs: drop num argument from find_live_mirror()

2018-01-29 Thread Anand Jain
Obtain the stripes info from the map directly and so no need to pass it as an argument. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f7147740b68e..9c9d987838c2

[PATCH 0/2] Preparatory to add read_mirror mount option

2018-01-29 Thread Anand Jain
Adds cleanups to find_live_mirror(), so that we can add more policy on how the read mirror device should be found. Anand Jain (2): btrfs: drop num argument from find_live_mirror() btrfs: drop optimal argument from find_live_mirror() fs/btrfs/volumes.c | 20 ++-- 1 file

[PATCH 0/2] Policy to balance read across mirrored devices

2018-01-29 Thread Anand Jain
h set: [PATCH 0/2] Preparatory to add read_mirror mount option Anand Jain (2): btrfs: add mount option read_mirror_policy btrfs: add read_mirror_policy parameter devid fs/btrfs/ctree.h | 2 ++ fs/btrfs/super.c | 31 +++ fs/btrfs/volumes.c | 18 +

[PATCH 2/2] btrfs: add read_mirror_policy parameter devid

2018-01-29 Thread Anand Jain
. Signed-off-by: Anand Jain --- fs/btrfs/super.c | 21 + fs/btrfs/volumes.c | 10 ++ fs/btrfs/volumes.h | 2 ++ 3 files changed, 33 insertions(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index dfe6b3c67df3..d3aad87e 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs

[PATCH 2/2] btrfs: drop optimal argument from find_live_mirror()

2018-01-29 Thread Anand Jain
Drop optimal argument from the function find_live_mirror() as we can deduce it in the function itself. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 9c9d987838c2

[PATCH 1/2] btrfs: add mount option read_mirror_policy

2018-01-29 Thread Anand Jain
$pid policy configurable from the mount option. For example.. mount -o read_mirror_policy=pid (which is also default) Signed-off-by: Anand Jain --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/super.c | 10 ++ fs/btrfs/volumes.c | 8 +++- fs/btrfs/volumes.h | 5 + 4 files changed

Re: [PATCH 1/3] btrfs: Refactor __get_raid_index() to btrfs_bg_flags_to_raid_index()

2018-01-30 Thread Anand Jain
to define it as a normal function. This also makes later code re-use between kernel and btrfs-progs easier. Signed-off-by: Qu Wenruo Reviewed-by: Anand Jain Thanks, Anand --- fs/btrfs/extent-tree.c | 26 -- fs/btrfs/volumes.c | 2 +- fs/btrfs

Re: [PATCH 2/3] btrfs: Unexport get_block_group_index()

2018-01-30 Thread Anand Jain
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e9c31b567a9c..6e1128aa29d6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -7346,7 +7346,8 @@ wait_block_group_cache_done(struct btrfs_block_group_cache *cache) return ret; } -int get_block_gro

Re: [PATCH 3/3] btrfs: Refactor parameter of BTRFS_MAX_DEVS() from root to fs_info

2018-01-30 Thread Anand Jain
On 01/30/2018 03:40 PM, Qu Wenruo wrote: Signed-off-by: Qu Wenruo Reviewed-by: Anand Jain Thanks, Anand --- fs/btrfs/volumes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d818b1f9c625..215e85e22c8e 100644

Re: [PATCH 2/2] btrfs: drop optimal argument from find_live_mirror()

2018-01-30 Thread Anand Jain
On 01/30/2018 05:12 PM, Nikolay Borisov wrote: On 30.01.2018 08:28, Anand Jain wrote: Drop optimal argument from the function find_live_mirror() as we can deduce it in the function itself. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 8 1 file changed, 4 insertions(+), 4

Re: [PATCH v2 1/2] btrfs: fix device order consistency

2018-01-30 Thread Anand Jain
+static int device_sort(void *priv, struct list_head *a, struct list_head *b) I'll rename that to devid_cmp as it's the comparator and not really a sorting function. Ok. I will make that change in v3. Thanks, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs"

[PATCH v3 1/2] btrfs: fix device order consistency

2018-01-30 Thread Anand Jain
devices are having and same SB generation. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 16 1 file changed, 16 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index b5036bd69e6a..0109f370ad5b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c

[PATCH v3 0/2] fix device orders consistency

2018-01-30 Thread Anand Jain
oducing the missing chunk related problems more consistent. (More fixes of this sort is coming up). Anand Jain (2): btrfs: fix device order consistency btrfs: fix alloc device order consistency fs/btrfs/volumes.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) --

Re: [PATCH] Btrfs: fix null pointer dereference when replacing missing device

2018-01-30 Thread Anand Jain
n writing this patch. Thanks for the fix. Reviewed-by: Anand Jain Thanks, Anand --- fs/btrfs/extent-tree.c | 4 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 9d220b276c8f..d59ee24645e3 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs

[PATCH v3 2/2] btrfs: fix alloc device order consistency

2018-01-30 Thread Anand Jain
Add opened device to the tail of dev_alloc_list instead of head, so that it maintains the same order as dev_list. 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/volumes.c index 0109f370ad5b

Re: [PATCH 0/2] Policy to balance read across mirrored devices

2018-01-31 Thread Anand Jain
On 01/31/2018 03:51 PM, Peter Becker wrote: A little question about mount -o read_mirror_policy=. How would this work with RAID1 over 3 or 4 HDD's? In particular, if the desired block is not available on device . When a stripe is not present on the read optimized disk it will just use the

Re: [PATCH 1/2] btrfs: add mount option read_mirror_policy

2018-01-31 Thread Anand Jain
On 01/31/2018 04:06 PM, Nikolay Borisov wrote: diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1a462ab85c49..4759e988b0df 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1100,6 +1100,8 @@ struct btrfs_fs_info { spinlock_t ref_verify_lock; struct rb_root block_tr

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

2018-01-31 Thread Anand Jain
On 01/31/2018 04:38 PM, Nikolay Borisov wrote: On 30.01.2018 08:30, Anand Jain wrote: 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 will go to that particular device only. This also

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

2018-01-31 Thread Anand Jain
On 01/31/2018 05:54 PM, Nikolay Borisov wrote: On 31.01.2018 11:28, Anand Jain wrote: On 01/31/2018 04:38 PM, Nikolay Borisov wrote: On 30.01.2018 08:30, Anand Jain wrote: Adds the mount option:    mount -o read_mirror_policy= To set the devid of the device which should be used for

Re: [PATCH 0/2] Policy to balance read across mirrored devices

2018-01-31 Thread Anand Jain
On 01/31/2018 06:47 PM, Peter Becker wrote: 2018-01-31 10:01 GMT+01:00 Anand Jain : When a stripe is not present on the read optimized disk it will just use the lower devid disk containing the stripe (instead of failing back to the pid based random disk). Is this a good behavior

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

2018-01-31 Thread Anand Jain
On 01/31/2018 09:42 PM, Nikolay Borisov wrote: So usually this should be functionality handled by the raid/san controller I guess, > but given that btrfs is playing the role of a controller here at what point are we drawing the line of not implementing block-level functionality into the files

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

2018-02-01 Thread Anand Jain
On 02/01/2018 01:26 PM, Edmund Nadolski wrote: On 1/31/18 7:36 AM, Anand Jain wrote: On 01/31/2018 09:42 PM, Nikolay Borisov wrote: So usually this should be functionality handled by the raid/san controller I guess, > but given that btrfs is playing the role of a controller here at w

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

2019-10-07 Thread Anand Jain
On 10/8/19 1:41 AM, David Sterba wrote: On Wed, Oct 02, 2019 at 12:11:52PM +0800, Anand Jain wrote: To help debug device scan issues, add verbose option to btrfs device scan. The common options like --verbose are going to be added into the global command so I'd rather avoid adding them t

Re: [PATCH 4/5] btrfs: remove identified alien device in open_fs_devices

2019-10-07 Thread Anand Jain
On 10/8/19 1:03 AM, David Sterba wrote: On Mon, Oct 07, 2019 at 09:37:49PM +0800, Qu Wenruo wrote: On 2019/10/7 下午9:30, Nikolay Borisov wrote: On 7.10.19 г. 12:45 ч., Anand Jain wrote: Following test case explains it all, even though the degraded mount is successful the btrfs-progs fails

Re: [PATCH v3 0/5] btrfs: fix issues due to alien device

2019-10-07 Thread Anand Jain
On 10/8/19 1:36 AM, David Sterba wrote: On Mon, Oct 07, 2019 at 05:45:10PM +0800, Anand Jain wrote: v3: Fix alien device is due to wipefs in Patch4. Fix a nit in Patch3. Patches are reordered. Alien device is a device in fs_devices list having a different fsid than the expected fsid

Re: [PATCH] btrfs: opencode extent_buffer_get

2019-10-09 Thread Anand Jain
(), free_extent_buffer_stale(), release_extent_buffer() and alloc_extent_buffer() in free_eb label ;-) -ditto- ;-) Reviewed-by: Anand Jain Reviewed-by: Johannes Thumshirn

<    4   5   6   7   8   9   10   11   12   13   >