Re: [RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:25, Misono, Tomohiro wrote: > Hello all, > > I want to address some issues of subvolume usability for a normal user. > i.e. a user can create subvolumes, but > - Cannot delete their own subvolume (by default) > - Cannot tell subvolumes from directories (in a straightforward

Re: [PATCH 4/7] btrfs-progs: Use list_for_each_entry in write_dev_all_supers

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:39, Nikolay Borisov wrote: > No need to use extra variable and 2 macros when we can succintly use 1. > > Signed-off-by: Nikolay Borisov Straightforward cleanup. Although I found several other places with the same problem. It would be better to address

[PATCH 5/7] btrfs-progs: Document logic of btrfs_read_dev_super

2017-12-05 Thread Nikolay Borisov
Signed-off-by: Nikolay Borisov --- disk-io.c | 17 + 1 file changed, 17 insertions(+) diff --git a/disk-io.c b/disk-io.c index 3d8785d5bb37..40077d4919c6 100644 --- a/disk-io.c +++ b/disk-io.c @@ -1419,6 +1419,23 @@ static int check_super(struct

[PATCH 4/7] btrfs-progs: Use list_for_each_entry in write_dev_all_supers

2017-12-05 Thread Nikolay Borisov
No need to use extra variable and 2 macros when we can succintly use 1. Signed-off-by: Nikolay Borisov --- disk-io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/disk-io.c b/disk-io.c index f5edc4796619..3d8785d5bb37 100644 --- a/disk-io.c +++

Re: [PATCH] btrfs/124: add balance --full-balance option

2017-12-05 Thread Eryu Guan
On Tue, Dec 05, 2017 at 04:30:33PM +0800, Qu Wenruo wrote: > > > On 2017年12月05日 16:26, Anand Jain wrote: > > btrfs balance needs --full-balance option since 4.6, so check the > > version and then use it. > > > > As this may be useful for other btrfs tests as well, so this patch > > adds

[PATCH v4] btrfs-progs: add 'btrfs device ignore' cli

2017-12-05 Thread Anand Jain
This patch adds btrfs device ignode so that a device can be ignored/missed during mount if the device is already been scanned. Basically, this command will undo the effect of the command btrfs device scan This change is compatible with older kernel without the ioctl BTRFS_IOC_IGNORE_DEV

[PATCH v4 0/2] Add cli and ioctl to ignore a scanned device

2017-12-05 Thread Anand Jain
Patch 1/2 is preparatory patch to get a function to delete a device from the list. Patch 2/2 adds the ioctl and feature to delete a device from the device list. Also includes Patch 1/1 for the btrfs-progs support. v2: Accepts review from Nikolay, details are in the specific patch. Patch

[PATCH v4 2/2] btrfs: introduce feature to ignore a btrfs device

2017-12-05 Thread Anand Jain
Support for a new command is being added here: btrfs dev ignore Which shall undo the effects of the command btrfs dev scan This cli/ioctl is needed as there is no way to continue to mount in degraded mode if the device is already scanned, which is required to recover from the split brain raid

[PATCH v4 1/2] btrfs: add function to device list delete

2017-12-05 Thread Anand Jain
We need device delete from the dev_list so create a new function. New instead of refactor of btrfs_free_stale_device() because, btrfs_free_stale_device() doesn't hold device_list_mutex which is actually needed here. Signed-off-by: Anand Jain --- v1: title of this patch

[PATCH v3] Btrfs: heuristic replace heap sort with radix sort

2017-12-05 Thread Timofey Titovets
Slowest part of heuristic for now is kernel heap sort() It's can take up to 55% of runtime on sorting bucket items. As sorting will always call on most data sets to get correctly byte_core_set_size, the only way to speed up heuristic, is to speed up sort on bucket. Add a general radix_sort

Re: [PATCH 3/3] Btrfs: make raid6 rebuild retry more

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 06:40, Liu Bo wrote: > There is a scenario that can end up with rebuild process failing to > return good content, i.e. > suppose that all disks can be read without problems and if the content > that was read out doesn't match its checksum, currently for raid6 > btrfs at most

Re: [PATCH 3/3] Btrfs: make raid6 rebuild retry more

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 06:40, Liu Bo wrote: > There is a scenario that can end up with rebuild process failing to > return good content, i.e. > suppose that all disks can be read without problems and if the content > that was read out doesn't match its checksum, currently for raid6 > btrfs at most

Re: [PATCH] btrfs/124: add balance --full-balance option

2017-12-05 Thread Anand Jain
On 12/05/2017 04:30 PM, Qu Wenruo wrote: On 2017年12月05日 16:26, Anand Jain wrote: btrfs balance needs --full-balance option since 4.6, so check the version and then use it. As this may be useful for other btrfs tests as well, so this patch adds _btrfs_full_balance_option() to the

Re: [PATCH 4/7] btrfs-progs: Use list_for_each_entry in write_dev_all_supers

2017-12-05 Thread Nikolay Borisov
On 5.12.2017 11:14, Qu Wenruo wrote: > > > On 2017年12月05日 16:39, Nikolay Borisov wrote: >> No need to use extra variable and 2 macros when we can succintly use 1. >> >> Signed-off-by: Nikolay Borisov > > Straightforward cleanup. > > Although I found several other places

Re: [PATCH] btrfs: Handle btrfs_set_extent_delalloc failure

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 15:29, Nikolay Borisov wrote: > This function was introduced by 247e743cbe6e ("Btrfs: Use async helpers to > deal > with pages that have been improperly dirtied") and it didn't do any error > handling then. This function might very well fail in ENOMEM situation, yet > it's not

[RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Misono, Tomohiro
Hello all, I want to address some issues of subvolume usability for a normal user. i.e. a user can create subvolumes, but - Cannot delete their own subvolume (by default) - Cannot tell subvolumes from directories (in a straightforward way) - Cannot check the quota limit when qgroup is enabled

Re: [PATCH 2/7] btrfs-progs: Factor out common print_device_info

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:39, Nikolay Borisov wrote: > This function has been copied twice in chunk-recover and super-recover. Factor > it out into utils.c/h and use it. No functional changes. > > Signed-off-by: Nikolay Borisov Reviewed-by: Qu Wenruo Thanks, Qu >

Re: [PATCH] btrfs/124: add balance --full-balance option

2017-12-05 Thread Anand Jain
On 12/05/2017 04:40 PM, Eryu Guan wrote: On Tue, Dec 05, 2017 at 04:30:33PM +0800, Qu Wenruo wrote: On 2017年12月05日 16:26, Anand Jain wrote: btrfs balance needs --full-balance option since 4.6, so check the version and then use it. As this may be useful for other btrfs tests as well, so

Re: [PATCH 3/7] btrfs-progs: Remove recover_get_good_super

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:39, Nikolay Borisov wrote: > Currently getting the good super really consists of just getting the first > entry > on the linked list, since it's the one with the highest transid. So remove > the function and just use list_first_entry directly. > > Signed-off-by: Nikolay

Re: [PATCH 5/7] btrfs-progs: Document logic of btrfs_read_dev_super

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:39, Nikolay Borisov wrote: > Signed-off-by: Nikolay Borisov > --- > disk-io.c | 17 + > 1 file changed, 17 insertions(+) > > diff --git a/disk-io.c b/disk-io.c > index 3d8785d5bb37..40077d4919c6 100644 > --- a/disk-io.c > +++ b/disk-io.c >

[PATCH] btrfs/124: add balance --full-balance option

2017-12-05 Thread Anand Jain
btrfs balance needs --full-balance option since 4.6, so check the version and then use it. As this may be useful for other btrfs tests as well, so this patch adds _btrfs_full_balance_option() to the common/btrfs file. Signed-off-by: Anand Jain --- common/btrfs| 13

Re: [PATCH] btrfs/124: add balance --full-balance option

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:26, Anand Jain wrote: > btrfs balance needs --full-balance option since 4.6, so check the > version and then use it. > > As this may be useful for other btrfs tests as well, so this patch > adds _btrfs_full_balance_option() to the common/btrfs file. > > Signed-off-by: Anand

[PATCH 7/7] btrfs-progs: Fix super-recovery

2017-12-05 Thread Nikolay Borisov
Commit 3296d058b7ce ("btrfs-progs: super-recover: Reuse btrfs_read_dev_super function") changed the logic when a superblock is added to the bad block list to depend on -EIO. However currently btrfs_read_dev_super doesn't return -EIO when the fist super block is broken. Instead it returns -1. This

[PATCH 2/7] btrfs-progs: Factor out common print_device_info

2017-12-05 Thread Nikolay Borisov
This function has been copied twice in chunk-recover and super-recover. Factor it out into utils.c/h and use it. No functional changes. Signed-off-by: Nikolay Borisov --- chunk-recover.c | 18 -- super-recover.c | 13 - utils.c | 18

[PATCH 3/7] btrfs-progs: Remove recover_get_good_super

2017-12-05 Thread Nikolay Borisov
Currently getting the good super really consists of just getting the first entry on the linked list, since it's the one with the highest transid. So remove the function and just use list_first_entry directly. Signed-off-by: Nikolay Borisov --- super-recover.c | 13

[PATCH 6/7] btrfs-progs: Add test for super block recovery

2017-12-05 Thread Nikolay Borisov
This functionality regressed some time ago and it was never caught. Seems no one complained of that, but to be sure add a regression test to prevent future regressions. Signed-off-by: Nikolay Borisov --- tests/fsck-tests/029-superblock-recovery/test.sh | 64

[PATCH 0/7] Misc btrfs-progs cleanups/fixes

2017-12-05 Thread Nikolay Borisov
Here is a series doing some minor code cleanups, hopefully making the code more idiomatic and easier to follow. They should be pretty low-risk and introduce no functional changes (patches 1-5). The the last 2 patches deal with a regression of btrfs rescue super-recovery. Turns out this was

[PATCH 1/7] btrfs-progs: Explictly state test.sh must be executable

2017-12-05 Thread Nikolay Borisov
Signed-off-by: Nikolay Borisov --- tests/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index 04d2ce2ab40d..c456018554cc 100644 --- a/tests/README.md +++ b/tests/README.md @@ -164,7 +164,9 @@ how to do mkfs,

Re: [PATCH 1/7] btrfs-progs: Explictly state test.sh must be executable

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:39, Nikolay Borisov wrote: > Signed-off-by: Nikolay Borisov > --- > tests/README.md | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tests/README.md b/tests/README.md > index 04d2ce2ab40d..c456018554cc 100644 > ---

Re: [PATCH 7/7] btrfs-progs: Fix super-recovery

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:39, Nikolay Borisov wrote: > Commit 3296d058b7ce ("btrfs-progs: super-recover: Reuse > btrfs_read_dev_super function") Oh my fault. > changed the logic when a superblock > is added to the bad block list to depend on -EIO. However currently > btrfs_read_dev_super doesn't

[PATCH] btrfs-progs: use enum instead of constant value

2017-12-05 Thread Gu Jinxiang
Add a enum for reada of btrfs_path to be consistent with kernel. Signed-off-by: Gu Jinxiang --- ctree.c | 3 ++- ctree.h | 2 +- extent-tree.c | 12 ++-- free-space-tree.c | 2 +- qgroup-verify.c | 2 +- volumes.c | 4 ++-- 6

Re: [PATCH 6/7] btrfs-progs: Add test for super block recovery

2017-12-05 Thread Nikolay Borisov
On 5.12.2017 13:12, Qu Wenruo wrote: > > > On 2017年12月05日 18:04, Nikolay Borisov wrote: >> >> >> On 5.12.2017 11:33, Qu Wenruo wrote: >>> >>> >>> On 2017年12月05日 16:39, Nikolay Borisov wrote: This functionality regressed some time ago and it was never caught. Seems no one

[PATCH] btrfs: use enum instead of constant value

2017-12-05 Thread Gu Jinxiang
Use enum READA_BACK instead of value 1 to keep source robust. Signed-off-by: Gu Jinxiang --- fs/btrfs/free-space-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c index a5e34de..a105629

[PATCH v2] btrfs/124: add balance --full-balance option

2017-12-05 Thread Anand Jain
btrfs balance needs --full-balance option since 4.6, so check the version and then use it. As this may be useful for other btrfs tests as well, so this patch also adds _run_btrfs_balance_start() to the common/btrfs file. Signed-off-by: Anand Jain --- v2: Use help to find

Re: [PATCH 6/7] btrfs-progs: Add test for super block recovery

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 16:39, Nikolay Borisov wrote: > This functionality regressed some time ago and it was never caught. Seems no > one complained of that, but to be sure add a regression test to prevent > future > regressions. > > Signed-off-by: Nikolay Borisov One nitpick for

Re: [PATCH 6/7] btrfs-progs: Add test for super block recovery

2017-12-05 Thread Nikolay Borisov
On 5.12.2017 11:33, Qu Wenruo wrote: > > > On 2017年12月05日 16:39, Nikolay Borisov wrote: >> This functionality regressed some time ago and it was never caught. Seems no >> one complained of that, but to be sure add a regression test to prevent >> future >> regressions. >> >> Signed-off-by:

Re: [PATCH 6/7] btrfs-progs: Add test for super block recovery

2017-12-05 Thread Qu Wenruo
On 2017年12月05日 18:04, Nikolay Borisov wrote: > > > On 5.12.2017 11:33, Qu Wenruo wrote: >> >> >> On 2017年12月05日 16:39, Nikolay Borisov wrote: >>> This functionality regressed some time ago and it was never caught. Seems no >>> one complained of that, but to be sure add a regression test to

Re: [PATCH v4 1/2] btrfs: add function to device list delete

2017-12-05 Thread Anand Jain
On 12/06/2017 03:06 AM, David Sterba wrote: On Tue, Dec 05, 2017 at 04:52:56PM +0800, Anand Jain wrote: We need device delete from the dev_list so create a new function. New instead of refactor of btrfs_free_stale_device() because, btrfs_free_stale_device() doesn't hold device_list_mutex

Re: [RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Goffredo Baroncelli
On 12/05/2017 09:17 PM, Austin S. Hemmelgarn wrote: > On 2017-12-05 14:09, Goffredo Baroncelli wrote: >> On 12/05/2017 07:46 PM, Graham Cobb wrote: >>> On 05/12/17 18:01, Goffredo Baroncelli wrote: On 12/05/2017 04:42 PM, Graham Cobb wrote: >> [] >>> Then no impact to kernel, all

Re: [PATCH] Btrfs: use struct completion in scrub_submit_raid56_bio_wait

2017-12-05 Thread David Sterba
On Thu, Nov 30, 2017 at 05:26:39PM -0700, Liu Bo wrote: > This changes to use struct completion directly and removes 'struct > scrub_bio_ret' along with the code using it. > > This struct is used to get the return value from bio, but the caller > can access bio to get the return value directly

Re: [RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Austin S. Hemmelgarn
On 2017-12-05 14:09, Goffredo Baroncelli wrote: On 12/05/2017 07:46 PM, Graham Cobb wrote: On 05/12/17 18:01, Goffredo Baroncelli wrote: On 12/05/2017 04:42 PM, Graham Cobb wrote: [] Then no impact to kernel, all complex work is done in user space. Exactly how hard is it to just check

Re: [PATCH 3/3] Btrfs: make raid6 rebuild retry more

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 11:04:03AM -0700, Liu Bo wrote: > On Tue, Dec 05, 2017 at 04:07:35PM +0800, Qu Wenruo wrote: > > > > > > On 2017年12月05日 06:40, Liu Bo wrote: > > > There is a scenario that can end up with rebuild process failing to > > > return good content, i.e. > > > suppose that all

Re: Read before you deploy btrfs + zstd

2017-12-05 Thread Nick Terrell
> On Dec 5, 2017, at 7:54 AM, David Sterba wrote: > > I had a different branch with patches from openSUSE, so the diffs apply with > minimal efforts to the package. The branch btrfs-zstd has been synced up. The > ENOMEM error was not from the file decompression but from the

Re: [PATCH v2 0/5] define BTRFS_DEV_STATE

2017-12-05 Thread Anand Jain
On 12/05/2017 09:07 PM, David Sterba wrote: On Tue, Dec 05, 2017 at 09:20:38AM +0800, Anand Jain wrote: On 12/05/2017 04:28 AM, David Sterba wrote: On Mon, Dec 04, 2017 at 12:54:51PM +0800, Anand Jain wrote: As of now device properties and states are being represented as int variable. So

Re: [PATCH 0/7] retry write on error

2017-12-05 Thread David Sterba
On Thu, Nov 30, 2017 at 12:22:53PM -0800, Liu Bo wrote: > > > I agree with Ed and Peter, similar opinion was posted here [1]. > > > https://www.spinics.net/lists/linux-btrfs/msg70240.html > > > > All the points in this thread speak against retries on the filesystem > > level and I agree.

Re: [PATCH] btrfs: Handle btrfs_set_extent_delalloc failure

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 04:10:59PM +0800, Qu Wenruo wrote: > > > On 2017年12月05日 15:29, Nikolay Borisov wrote: > > This function was introduced by 247e743cbe6e ("Btrfs: Use async helpers to > > deal > > with pages that have been improperly dirtied") and it didn't do any error > > handling then.

Re: [PATCH] Btrfs: remove useless wait in lock_stripe_add

2017-12-05 Thread David Sterba
On Mon, Dec 04, 2017 at 06:09:42PM -0700, Liu Bo wrote: > The defined wait is not used anywhere. > > Signed-off-by: Liu Bo Reviewed-by: David Sterba -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to

Re: [PATCH 3/3] Btrfs: make raid6 rebuild retry more

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 04:07:35PM +0800, Qu Wenruo wrote: > > @@ -2166,11 +2166,21 @@ int raid56_parity_recover(struct btrfs_fs_info > > *fs_info, struct bio *bio, > > } > > > > /* > > -* reconstruct from the q stripe if they are > > -* asking for mirror 3 > > +* Loop

Re: [RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Goffredo Baroncelli
On 12/05/2017 09:25 AM, Misono, Tomohiro wrote: > Hello all, > > I want to address some issues of subvolume usability for a normal user. > i.e. a user can create subvolumes, but > - Cannot delete their own subvolume (by default) > - Cannot tell subvolumes from directories (in a straightforward

How exclusive in parent qgroup is computed? (was: Re: exclusive subvolume space missing)

2017-12-05 Thread Andrei Borzenkov
02.12.2017 03:27, Qu Wenruo пишет: > > That's the difference between how sub show and quota works. > > For quota, it's per-root owner check. > Means even a file extent is shared between different inodes, if all > inodes are inside the same subvolume, it's counted as exclusive. > And if any of

Re: [PATCH 3/3] Btrfs: make raid6 rebuild retry more

2017-12-05 Thread Liu Bo
On Tue, Dec 05, 2017 at 04:07:35PM +0800, Qu Wenruo wrote: > > > On 2017年12月05日 06:40, Liu Bo wrote: > > There is a scenario that can end up with rebuild process failing to > > return good content, i.e. > > suppose that all disks can be read without problems and if the content > > that was read

Re: [PATCH] btrfs: use enum instead of constant value

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 06:35:30PM +0800, Gu Jinxiang wrote: > Use enum READA_BACK instead of value 1 to keep source robust. Are you sure that READA_BACK is the right one? It corresponds to the value 1, but the actual readahead direction semantics should be considered. It is not obvious and needs

Re: [PATCH 1/3] Btrfs: remove redundant check in rbio_can_merge

2017-12-05 Thread David Sterba
On Mon, Dec 04, 2017 at 03:40:35PM -0700, Liu Bo wrote: > Given the above > ' > if (last->operation != cur->operation) > return 0; > ', > it's guaranteed that two operations are same. > > Signed-off-by: Liu Bo Reviewed-by: David Sterba -- To

Re: [PATCH 0/3] Btrfs: loop retry on raid6 read failures

2017-12-05 Thread David Sterba
On Mon, Dec 04, 2017 at 03:40:34PM -0700, Liu Bo wrote: > Patch 1 is a simple cleanup. > Patch 2 fixes a bug in raid56 rbio merging code. > Patch 3 fixes a bug in raid6 reconstruction process which can end up > read failure when it can rebuild up good data. > > Liu Bo (3): > Btrfs: remove

Re: [PATCH] btrfs: Handle btrfs_set_extent_delalloc failure

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 09:29:19AM +0200, Nikolay Borisov wrote: > This function was introduced by 247e743cbe6e ("Btrfs: Use async helpers to > deal > with pages that have been improperly dirtied") and it didn't do any error > handling then. This function might very well fail in ENOMEM situation,

Re: [PATCH v4] btrfs-progs: add 'btrfs device ignore' cli

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 04:52:57PM +0800, Anand Jain wrote: > This patch adds > btrfs device ignode > so that a device can be ignored/missed during mount if the device is > already been scanned. Basically, this command will undo the effect > of the command > btrfs device scan As it logicall

Chunk-Recovery fails with alignment error

2017-12-05 Thread Benjamin Beichler
Hi, I have a setup as following: (1,7TB drive + 128GB SSD in Bcache) <==> luks device <==> btrfs FS I have been running Arch linux with newest stable kernel 4.14. After a reboot last week my btrfs volume becomes unmountable, because of checksum errors in the chunk root. These are the outputs

Re: [RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Goffredo Baroncelli
On 12/05/2017 04:42 PM, Graham Cobb wrote: > On 05/12/17 12:41, Austin S. Hemmelgarn wrote: >> On 2017-12-05 03:43, Qu Wenruo wrote: >>> >>> >>> On 2017年12月05日 16:25, Misono, Tomohiro wrote: Hello all, I want to address some issues of subvolume usability for a normal user. i.e.

Re: [PATCH 2/3] Btrfs: do not merge rbios if their fail stripe index are not identical

2017-12-05 Thread David Sterba
On Mon, Dec 04, 2017 at 03:40:36PM -0700, Liu Bo wrote: > Since fail stripe index in rbio would be used to decide which > algorithm reconstruction would be run, we cannot merge rbios if > their's fail striped index are different, otherwise, one of the two > reconstructions would fail. > >

Re: [RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Graham Cobb
On 05/12/17 18:01, Goffredo Baroncelli wrote: > On 12/05/2017 04:42 PM, Graham Cobb wrote: >> On 05/12/17 12:41, Austin S. Hemmelgarn wrote: >>> On 2017-12-05 03:43, Qu Wenruo wrote: On 2017年12月05日 16:25, Misono, Tomohiro wrote: > Hello all, > > I want to address some

Re: [RFC] Improve subvolume usability for a normal user

2017-12-05 Thread Goffredo Baroncelli
On 12/05/2017 07:46 PM, Graham Cobb wrote: > On 05/12/17 18:01, Goffredo Baroncelli wrote: >> On 12/05/2017 04:42 PM, Graham Cobb wrote: [] > Then no impact to kernel, all complex work is done in user space. Exactly how hard is it to just check ownership of the root inode of a

Re: [PATCH v4 1/2] btrfs: add function to device list delete

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 04:52:56PM +0800, Anand Jain wrote: > We need device delete from the dev_list so create a new function. > New instead of refactor of btrfs_free_stale_device() because, > btrfs_free_stale_device() doesn't hold device_list_mutex which > is actually needed here. > >

Re: [PATCH v4 2/2] btrfs: introduce feature to ignore a btrfs device

2017-12-05 Thread David Sterba
On Tue, Dec 05, 2017 at 04:52:58PM +0800, Anand Jain wrote: > Support for a new command is being added here: > btrfs dev ignore > Which shall undo the effects of the command > btrfs dev scan > > This cli/ioctl is needed as there is no way to continue to mount in > degraded mode if the device

Re: Chunk-Recovery fails with alignment error

2017-12-05 Thread Qu Wenruo
On 2017年12月06日 03:22, Benjamin Beichler wrote: > Hi, > > I have a setup as following: (1,7TB drive + 128GB SSD in Bcache) <==> > luks device <==> btrfs FS > I have been running Arch linux with newest stable kernel 4.14. > > After a reboot last week my btrfs volume becomes unmountable, because

[PATCH v4 60/73] dax: Convert __dax_invalidate_mapping_entry to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Simple now that we already have an xa_state! Signed-off-by: Matthew Wilcox --- fs/dax.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index ad984dece12e..66f6c4ea18f7

[PATCH v4 62/73] dax: Convert dax_insert_pfn_mkwrite to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- fs/dax.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 7bd94f1b61d0..619aff70583f 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -1498,21

[PATCH v4 64/73] dax: Convert grab_mapping_entry to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- fs/dax.c | 98 +--- 1 file changed, 26 insertions(+), 72 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index

[PATCH v4 43/73] shmem: Convert find_swap_entry to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This is a 1:1 conversion. Signed-off-by: Matthew Wilcox --- mm/shmem.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 654f367aca90..ce285ae635ea

[PATCH v4 44/73] shmem: Convert shmem_tag_pins to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Simplify the locking by taking the spinlock while we walk the tree on the assumption that many acquires and releases of the lock will be worse than holding the lock for a (potentially) long time. We could replicate the same locking behaviour with the

[PATCH v4 28/73] page cache: Remove stray radix comment

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 9e6158cfbaeb..79d0731b8762 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@

[PATCH v4 40/73] pagevec: Use xa_tag_t

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Removes sparse warnings. Signed-off-by: Matthew Wilcox --- fs/btrfs/extent_io.c| 4 ++-- fs/ext4/inode.c | 2 +- fs/f2fs/data.c | 2 +- fs/gfs2/aops.c | 2 +- include/linux/pagevec.h | 8

[PATCH v4 19/73] xarray: Add MAINTAINERS entry

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Add myself as XArray and IDR maintainer. Signed-off-by: Matthew Wilcox --- MAINTAINERS | 12 1 file changed, 12 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index d4fdcb12616c..b2f8d606756b 100644 ---

[PATCH v4 20/73] idr: Convert to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox The IDR distinguishes between unallocated entries (read as NULL) and entries where the user has chosen to store NULL. The radix tree was modified to consider NULL entries which had tag 0 _clear_ as being allocated, but it added a lot of complexity.

[PATCH v4 67/73] vmalloc: Convert to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox The radix tree of vmap blocks is simpler to express as an XArray. Saves a couple of hundred bytes of text and eliminates a user of the radix tree preload API. Signed-off-by: Matthew Wilcox --- mm/vmalloc.c | 39

[PATCH v4 61/73] dax: Convert dax_writeback_one to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Likewise easy Signed-off-by: Matthew Wilcox --- fs/dax.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 66f6c4ea18f7..7bd94f1b61d0 100644 --- a/fs/dax.c +++

[PATCH v4 68/73] brd: Convert to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Convert brd_pages from a radix tree to an XArray. Simpler and smaller code; in particular another user of radix_tree_preload is eliminated. Signed-off-by: Matthew Wilcox --- drivers/block/brd.c | 87

[PATCH v4 54/73] nilfs2: Convert to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox I'm not 100% convinced that the rewrite of nilfs_copy_back_pages is correct, but it will at least have different bugs from the current version. Signed-off-by: Matthew Wilcox --- fs/nilfs2/btnode.c | 37

[PATCH v4 70/73] xfs: Convert pag_ici_root to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Rename pag_ici_root to pag_ici_xa and use XArray APIs instead of radix tree APIs. Shorter code, typechecking on tag numbers, better error checking in xfs_reclaim_inode(), and eliminates a call to radix_tree_preload(). Signed-off-by: Matthew Wilcox

[PATCH v4 73/73] usb: Convert xhci-mem to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox The XArray API is a slightly better fit for xhci_insert_segment_mapping() than the radix tree API was. Signed-off-by: Matthew Wilcox --- drivers/usb/host/xhci-mem.c | 70 +

[PATCH v4 71/73] xfs: Convert xfs dquot to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This is a pretty straight-forward conversion. Signed-off-by: Matthew Wilcox --- fs/xfs/xfs_dquot.c | 33 + fs/xfs/xfs_qm.c| 32 fs/xfs/xfs_qm.h| 18

[PATCH v4 12/73] xarray: Add xa_cmpxchg

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This works like doing cmpxchg() on an array entry. Code which wants the radix_tree_insert() semantic of not overwriting an existing entry can cmpxchg() with NULL and get the action it wants. Plus, instead of having an error returned, they get the

[PATCH v4 33/73] mm: Convert delete_from_swap_cache to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Both callers of __delete_from_swap_cache have the swp_entry_t already, so pass that in to make constructing the XA_STATE easier. Signed-off-by: Matthew Wilcox --- include/linux/swap.h | 5 +++-- mm/swap_state.c | 24

[PATCH v4 34/73] mm: Convert cgroup writeback to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This is a fairly naive conversion, leaving in place the GFP_ATOMIC allocation. By switching the locking around, we could use GFP_KERNEL and probably simplify the error handling. Signed-off-by: Matthew Wilcox ---

[PATCH v4 35/73] mm: Convert __do_page_cache_readahead to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This one is trivial. Signed-off-by: Matthew Wilcox --- mm/readahead.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/readahead.c b/mm/readahead.c index f64b31b3a84a..66bcaffd47f0 100644 ---

[PATCH v4 51/73] btrfs: Convert page cache to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- fs/btrfs/compression.c | 4 +--- fs/btrfs/extent_io.c | 6 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index

[PATCH v4 26/73] page cache: Convert page cache lookups to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Introduce page_cache_pin() to factor out the common logic between the various lookup routines: find_get_entry find_get_entries find_get_pages_range find_get_pages_contig find_get_pages_range_tag find_get_entries_tag filemap_map_pages By using the

[PATCH v4 32/73] mm: Convert add_to_swap_cache to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Combine __add_to_swap_cache and add_to_swap_cache into one function since there is no more need to preload. Signed-off-by: Matthew Wilcox --- mm/swap_state.c | 93 ++--- 1

[PATCH v4 30/73] mm: Convert workingset to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox We construct a fake XA_STATE and use it to delete the node with xa_store() rather than adding a special function for this unique use case. Signed-off-by: Matthew Wilcox --- include/linux/swap.h | 4 ++-- mm/workingset.c

[PATCH v4 23/73] page cache: Add page_cache_range_empty function

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox btrfs has its own custom function for determining whether the page cache has any pages in a particular range. Move this functionality to the page cache, and call it from btrfs. Signed-off-by: Matthew Wilcox ---

[PATCH v4 31/73] mm: Convert truncate to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This is essentially xa_cmpxchg() with the locking handled above us, and it doesn't have to handle replacing a NULL entry. Signed-off-by: Matthew Wilcox --- mm/truncate.c | 15 ++- 1 file changed, 6 insertions(+),

[PATCH v4 09/73] xarray: Add xa_load

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This first function in the XArray API brings with it a lot of support infrastructure. The advanced API is based around the xa_state which is a more capable version of the radix_tree_iter. As the test-suite demonstrates, it is possible to use the

[PATCH v4 17/73] xarray: Add xas_next and xas_prev

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox These two functions move the xas index by one position, and adjust the rest of the iterator state to match it. This is more efficient than calling xas_set() as it keeps the iterator at the leaves of the tree instead of walking the iterator from the

[PATCH v4 02/73] xarray: Add the xa_lock to the radix_tree_root

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This results in no change in structure size on 64-bit x86 as it fits in the padding between the gfp_t and the void *. Signed-off-by: Matthew Wilcox --- fs/f2fs/gc.c | 2 +- include/linux/idr.h|

[PATCH v4 27/73] page cache: Convert delete_batch to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Rename the function from page_cache_tree_delete_batch to just page_cache_delete_batch. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git

[PATCH v4 72/73] xfs: Convert mru cache to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This eliminates a call to radix_tree_preload(). Signed-off-by: Matthew Wilcox --- fs/xfs/xfs_mru_cache.c | 72 +++--- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git

[PATCH v4 66/73] page cache: Finish XArray conversion

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox With no more radix tree API users left, we can drop the GFP flags and use xa_init() instead of INIT_RADIX_TREE(). Signed-off-by: Matthew Wilcox --- fs/inode.c | 2 +- include/linux/fs.h | 2 +- mm/swap_state.c| 2

[PATCH v4 69/73] xfs: Convert m_perag_tree to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Getting rid of the m_perag_lock lets us also get rid of the call to radix_tree_preload(). This is a relatively naive conversion; we could improve performance over the radix tree implementation by passing around xa_state pointers instead of indices,

[PATCH v4 18/73] xarray: Add xas_create_range

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox This hopefully temporary function is useful for users who have not yet been converted to multi-index entries. Signed-off-by: Matthew Wilcox --- include/linux/xarray.h | 2 ++ lib/xarray.c | 22

[PATCH v4 53/73] fs: Convert writeback to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox A couple of short loops. Signed-off-by: Matthew Wilcox --- fs/fs-writeback.c | 27 ++- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index

[PATCH v4 57/73] dax: Convert dax_unlock_mapping_entry to XArray

2017-12-05 Thread Matthew Wilcox
From: Matthew Wilcox Replace slot_locked() with dax_locked() and inline unlock_slot() into its only caller. Signed-off-by: Matthew Wilcox --- fs/dax.c | 50 -- 1 file changed, 16 insertions(+), 34

  1   2   >