Re: [PATCH RESEND 0/8] btrfs-progs: sub: Relax the privileges of "subvolume list/show"

2018-12-06 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 02:24:41PM +0900, Misono Tomohiro wrote: > Hello, > > This is basically the resend of > "[PATCH v2 00/20] btrfs-progs: Rework of "subvolume list/show" and relax the > root privileges of them" [1] > which I submitted in June. The aim of this series is to allow

[PATCH] libbtrfsutil: fix unprivileged tests if kernel lacks support

2018-12-06 Thread Omar Sandoval
From: Omar Sandoval I apparently didn't test this on a pre-4.18 kernel. test_subvolume_info_unprivileged() checks for an ENOTTY, but this doesn't seem to work correctly with subTest(). test_subvolume_iterator_unprivileged() doesn't have a check at all. Add an explicit check to both before doing

Re: [PATCH 9/9] btrfs: drop extra enum initialization where using defaults

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:59PM +0100, David Sterba wrote: > The first auto-assigned value to enum is 0, we can use that and not > initialize all members where the auto-increment does the same. This is > used for values that are not part of on-disk format. Reviewed-by: Omar Sandoval

Re: [PATCH 8/9] btrfs: switch BTRFS_ORDERED_* to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:57PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > ordered extent flags. Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba > --- > fs/btrfs/orde

Re: [PATCH 7/9] btrfs: switch BTRFS_*_LOCK to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:55PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > tree lock types. > > Signed-off-by: David Sterba > --- > fs/btrfs/locking.h | 10 ++ > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git

Re: [PATCH 6/9] btrfs: switch EXTENT_FLAG_* to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:52PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > extent map flags. Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba > --- > fs/btrfs/extent_map.h | 21 ++--- >

Re: [PATCH 5/9] btrfs: swtich EXTENT_BUFFER_* to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:50PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > extent buffer flags; This one has a "swtich" typo in the subject. Otherwise, Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba

Re: [PATCH 4/9] btrfs: switch BTRFS_ROOT_* to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:48PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > root tree flags. Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba > --- > fs/btrfs/ctree.h | 33 + &g

Re: [PATCH 3/9] btrfs: switch BTRFS_FS_* to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:45PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > internal filesystem states. Hah, looks like we never had a bit 0 ;) Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba > --- > fs/btr

Re: [PATCH 2/9] btrfs: switch BTRFS_BLOCK_RSV_* to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:43PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > block reserve types. Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba > --- > fs/btrfs/ctree.h | 19 --- >

Re: [PATCH 1/9] btrfs: switch BTRFS_FS_STATE_* to enums

2018-11-27 Thread Omar Sandoval
On Tue, Nov 27, 2018 at 08:53:41PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > global filesystem states. Reviewed-by: Omar Sandoval Some typos/wording suggestions below. > Signed-off-by: David Sterba > --- > fs/btr

Re: [PATCH 00/10] btrfs-progs: my libbtrfsutil patch queue

2018-11-26 Thread Omar Sandoval
On Mon, Nov 26, 2018 at 05:18:12PM +0100, David Sterba wrote: > On Tue, Nov 13, 2018 at 11:46:55PM -0800, Omar Sandoval wrote: > > From: Omar Sandoval > > > > Hi, > > > > This series contains my backlog of libbtrfsutil changes which I've been >

Re: [PATCH v2] btrfs: add zstd compression level support

2018-11-19 Thread Omar Sandoval
110 MB/s2.6 MB > > 15 3.036 MB/s110 MB/s2.6 MB > > > > [0] http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia > > > > Signed-off-by: Jennifer Liu > > Signed-off-by: Nick Terrell > > Reviewed-by: Omar Sandoval >

Re: [PATCH v2] btrfs: add zstd compression level support

2018-11-19 Thread Omar Sandoval
2 2.9513 MB/s113 MB/s1.8 MB > > >> 13 2.9510 MB/s111 MB/s2.3 MB > > >> 14 2.997 MB/s110 MB/s2.6 MB > > >> 15 3.036 MB/s110 MB/s2.6 MB > > >>

Re: [PATCH 5/6] btrfs: remove unused variable tree in end_compressed_bio_write()

2018-11-14 Thread Omar Sandoval
t; Remove 'tree' as well to silence the warning when -Wunused-but-set-variable > is used to compile btrfs. Reviewed-by: Omar Sandoval > Signed-off-by: Johannes Thumshirn > --- > fs/btrfs/compression.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/fs/btrfs/compressio

Re: [PATCH 4/6] btrfs: remove unused variable tree in bio_readpage_error()

2018-11-14 Thread Omar Sandoval
t; Remove 'tree' as well to silence the warning when -Wunused-but-set-variable is > used to compile btrfs. The subject says bio_readpage_error() but this is end_extent_writepage(). Otherwise, Reviewed-by: Omar Sandoval > Signed-off-by: Johannes Thumshirn > --- > fs/btrfs/extent_io.c |

Re: [PATCH 3/6] btrfs: remove unused function btrfs_sysfs_feature_update()

2018-11-14 Thread Omar Sandoval
t feature bits with > sysfs files). > > But commit e410e34fad91 (Revert "btrfs: synchronize incompat feature bits with > sysfs files") reverted 14e46e04958d so btrfs_sysfs_feature_update() ended up > as an unused function. Reviewed-by: Omar Sandoval > Signed-off-by:

Re: [PATCH 1/6] btrfs: remove unused drop_on_err in btrfs_mkdir()

2018-11-14 Thread Omar Sandoval
(btrfs: switch to discard_new_inode()) > discard_new_inode() is called when err is set and inode is non NULL. Therefore > drop_on_err is not used anymore and thus causes a warning when building with > -Wunused-but-set-variable. Reviewed-by: Omar Sandoval > Signed-off-by: Johannes Thumshirn

[PATCH 09/10] libbtrfsutil: bump version to 1.1.0

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval With the previous few fixes and features, we should bump the minor version. Signed-off-by: Omar Sandoval --- libbtrfsutil/btrfsutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbtrfsutil/btrfsutil.h b/libbtrfsutil/btrfsutil.h index d88c39e5

[PATCH 10/10] libbtrfsutil: document API in README

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval btrfsutil.h and the Python docstrings are thorough, but I've gotten a couple of requests for a high-level overview of the available interfaces and example usages. Add them to README.md. Signed-off-by: Omar Sandoval --- libbtrfsutil/README.md | 422

[PATCH 07/10] libbtrfsutil: relax the privileges of subvolume_info()

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval Attempt to use the BTRFS_IOC_GET_SUBVOL_INFO ioctl (added in kernel 4.18) for subvolume_info() if not root. Also, rename get_subvolume_info_root() -> get_subvolume_info_privileged() for consistency with further changes. This is based on a patch from Misono Tomohiro. Sig

[PATCH 08/10] libbtrfsutil: relax the privileges of subvolume iterator

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval We can use the new BTRFS_IOC_GET_SUBVOL_ROOTREF and BTRFS_IOC_INO_LOOKUP_USER ioctls to allow non-root users to list subvolumes. This is based on a patch from Misono Tomohiro but takes a different approach (mainly, this approach is more similar to the existing tree search

[PATCH 06/10] libbtrfsutil: allow tests to create multiple Btrfs instances

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval Some upcoming tests will need to create a second Btrfs filesystem, so add support for this to the test helpers. Signed-off-by: Omar Sandoval --- libbtrfsutil/python/tests/__init__.py | 35 +-- 1 file changed, 22 insertions(+), 13 deletions(-) diff

[PATCH 03/10] libbtrfsutil: document qgroup_inherit parameter in Python bindings

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval This has been supported since day one, but it wasn't documented. Signed-off-by: Omar Sandoval --- libbtrfsutil/python/module.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libbtrfsutil/python/module.c b/libbtrfsutil/python/module.c

[PATCH 05/10] libbtrfsutil: add test helpers for dropping privileges

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval These will be used for testing some upcoming changes which allow unprivileged operations. Signed-off-by: Omar Sandoval --- libbtrfsutil/python/tests/__init__.py | 31 ++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/libbtrfsutil

[PATCH 01/10] libbtrfsutil: use top=0 as default for SubvolumeIterator()

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval Right now, we're defaulting to top=5 (i.e, all subvolumes). The documented default is top=0 (i.e, only beneath the given path). This is the expected behavior. Fix it and make the test cases cover it. Reported-by: Jonathan Lemon Signed-off-by: Omar Sandoval

[PATCH 00/10] btrfs-progs: my libbtrfsutil patch queue

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval Hi, This series contains my backlog of libbtrfsutil changes which I've been collecting over the past few weeks. Patches 1-4 are fixes. Patches 5-6 add functionality to the unit tests which is needed for patches 7-8. Patches 7-8 add support for the unprivileged ioctls added

[PATCH 02/10] libbtrfsutil: change async parameters to async_ in Python bindings

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval async became a keyword in Python 3.7, so, e.g., create_subvolume('foo', async=True) is now a syntax error. Fix it with the Python convention of adding a trailing underscore to the keyword (async -> async_). This is what several other Python libraries did to han

[PATCH 04/10] libbtrfsutil: use SubvolumeIterator as context manager in tests

2018-11-13 Thread Omar Sandoval
From: Omar Sandoval We're leaking file descriptors, which makes it impossible to clean up the temporary mount point created by the test. Signed-off-by: Omar Sandoval --- libbtrfsutil/python/tests/test_subvolume.py | 51 - 1 file changed, 30 insertions(+), 21 deletions

Re: [PATCH v9 0/6] Btrfs: implement swap file support

2018-11-09 Thread Omar Sandoval
gt;> On Thu, Sep 27, 2018 at 11:17:32AM -0700, Omar Sandoval wrote: > > >>> From: Omar Sandoval > > >>> This series implements swap file support for Btrfs. > > >>> > > >>> Changes from v8 [1]: > > >>> > > >>>

Re: [PATCH v2] Btrfs: fix missing delayed iputs on unmount

2018-11-09 Thread Omar Sandoval
On Wed, Nov 07, 2018 at 05:01:19PM +0100, David Sterba wrote: > On Wed, Oct 31, 2018 at 10:06:08AM -0700, Omar Sandoval wrote: > > From: Omar Sandoval > > > > There's a race between close_ctree() and cleaner_kthread(). > > close_ctree() sets btrfs_fs_closing(),

[PATCH 5/7] btrfs: test swap files on multiple devices

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval Swap files currently need to exist on exactly one device in exactly one place. Signed-off-by: Omar Sandoval --- tests/btrfs/175 | 73 + tests/btrfs/175.out | 8 + tests/btrfs/group | 1 + 3 files changed, 82

[PATCH 4/7] btrfs: test invalid operations on a swap file

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval Btrfs forbids some operations which should not be done on a swap file. Signed-off-by: Omar Sandoval --- tests/btrfs/174 | 66 + tests/btrfs/174.out | 10 +++ tests/btrfs/group | 1 + 3 files changed, 77 insertions

[PATCH 6/7] btrfs: test device add/remove/replace with an active swap file

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval Make sure that we don't remove or replace a device with an active swap file but can add, remove, and replace other devices. Signed-off-by: Omar Sandoval --- tests/btrfs/176 | 82 + tests/btrfs/176.out | 5 +++ tests/btrfs

[PATCH 0/7] fstests: test Btrfs swapfile support

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval This series fixes a couple of generic swapfile tests and adds some Btrfs-specific swapfile tests. Btrfs swapfile support is scheduled for 4.21 [1]. 1: https://www.spinics.net/lists/linux-btrfs/msg83454.html Thanks! Omar Sandoval (7): generic/{472,496,497}: fix $seeqres

[PATCH 7/7] btrfs: test balance and resize with an active swap file

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval Make sure we don't shrink the device past an active swap file, but allow shrinking otherwise, as well as growing and balance. Signed-off-by: Omar Sandoval --- tests/btrfs/177 | 64 + tests/btrfs/177.out | 6 + tests

[PATCH 1/7] generic/{472,496,497}: fix $seeqres typo

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval Signed-off-by: Omar Sandoval --- tests/generic/472 | 2 +- tests/generic/496 | 2 +- tests/generic/497 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/generic/472 b/tests/generic/472 index c74d6c70..04ed3e73 100755 --- a/tests/generic/472 +++ b

[PATCH 2/7] generic/{472,496}: fix swap file creation on Btrfs

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval The swap file must be set nocow before it is written to, otherwise it is ignored and Btrfs refuses to activate it as swap. Fixes: 25ce9740065e ("generic: test swapfile creation, activation, and deactivation") Signed-off-by: Omar Sandoval --- tests/generi

[PATCH 3/7] btrfs: test swap file activation restrictions

2018-11-02 Thread Omar Sandoval
From: Omar Sandoval Swap files on Btrfs have some restrictions not applicable to other filesystems. Signed-off-by: Omar Sandoval --- tests/btrfs/173 | 55 + tests/btrfs/173.out | 5 + tests/btrfs/group | 1 + 3 files changed, 61

Re: [PATCH v2] Btrfs: fix missing delayed iputs on unmount

2018-11-01 Thread Omar Sandoval
On Thu, Nov 01, 2018 at 04:29:48PM +0100, David Sterba wrote: > On Thu, Nov 01, 2018 at 08:24:25AM -0700, Omar Sandoval wrote: > > On Thu, Nov 01, 2018 at 04:22:29PM +0100, David Sterba wrote: > > > On Thu, Nov 01, 2018 at 04:08:32PM +0100, David Sterba wrote: > > > >

Re: [PATCH v2] Btrfs: fix missing delayed iputs on unmount

2018-11-01 Thread Omar Sandoval
On Thu, Nov 01, 2018 at 08:24:25AM -0700, Omar Sandoval wrote: > On Thu, Nov 01, 2018 at 04:22:29PM +0100, David Sterba wrote: > > On Thu, Nov 01, 2018 at 04:08:32PM +0100, David Sterba wrote: > > > On Thu, Nov 01, 2018 at 01:31:18PM +, Chris Mason wrote: > > > >

Re: [PATCH v2] Btrfs: fix missing delayed iputs on unmount

2018-11-01 Thread Omar Sandoval
n Wed, Oct 31, 2018 at 10:06:08AM -0700, Omar Sandoval wrote: > > > >> From: Omar Sandoval > > > >> > > > >> There's a race between close_ctree() and cleaner_kthread(). > > > >> close_ctree() sets btrfs_fs_closing(), and the c

Re: [PATCH v2] Btrfs: fix missing delayed iputs on unmount

2018-11-01 Thread Omar Sandoval
On Thu, Nov 01, 2018 at 04:08:32PM +0100, David Sterba wrote: > On Thu, Nov 01, 2018 at 01:31:18PM +, Chris Mason wrote: > > On 1 Nov 2018, at 6:15, David Sterba wrote: > > > > > On Wed, Oct 31, 2018 at 10:06:08AM -0700, Omar Sandoval wrote: > > >> From:

[PATCH v2] Btrfs: fix missing delayed iputs on unmount

2018-10-31 Thread Omar Sandoval
From: Omar Sandoval There's a race between close_ctree() and cleaner_kthread(). close_ctree() sets btrfs_fs_closing(), and the cleaner stops when it sees it set, but this is racy; the cleaner might have already checked the bit and could be cleaning stuff. In particular, if it deletes unused

Re: [PATCH] Btrfs: fix missing delayed iputs on unmount

2018-10-31 Thread Omar Sandoval
On Wed, Oct 31, 2018 at 06:40:29PM +0200, Nikolay Borisov wrote: > > > On 31.10.18 г. 18:35 ч., Omar Sandoval wrote: > > On Wed, Oct 31, 2018 at 10:43:02AM +0200, Nikolay Borisov wrote: > >> > >> > >> On 31.10.18 г. 2:14 ч., Omar Sandoval wrote: >

Re: [PATCH] Btrfs: fix missing delayed iputs on unmount

2018-10-31 Thread Omar Sandoval
On Wed, Oct 31, 2018 at 03:41:47PM +0800, Lu Fengqi wrote: > On Tue, Oct 30, 2018 at 05:14:42PM -0700, Omar Sandoval wrote: > >From: Omar Sandoval > > > >There's a race between close_ctree() and cleaner_kthread(). > >close_ctree() sets btrfs_fs_closing(), and the cl

Re: [PATCH] Btrfs: fix missing delayed iputs on unmount

2018-10-31 Thread Omar Sandoval
On Wed, Oct 31, 2018 at 10:43:02AM +0200, Nikolay Borisov wrote: > > > On 31.10.18 г. 2:14 ч., Omar Sandoval wrote: > > From: Omar Sandoval > > > > There's a race between close_ctree() and cleaner_kthread(). > > close_ctree() sets btrfs_fs_closing(), and t

[PATCH] Btrfs: fix missing delayed iputs on unmount

2018-10-30 Thread Omar Sandoval
From: Omar Sandoval There's a race between close_ctree() and cleaner_kthread(). close_ctree() sets btrfs_fs_closing(), and the cleaner stops when it sees it set, but this is racy; the cleaner might have already checked the bit and could be cleaning stuff. In particular, if it deletes unused

Re: [PATCH] btrfs: add zstd compression level support

2018-10-30 Thread Omar Sandoval
6 MB > 153.036 MB/s 110 MB/s 2.6 MB > > [0] http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia Reviewed-by: Omar Sandoval > Signed-off-by: Jennifer Liu > Signed-off-by: Nick Terrell > --- > fs/btrfs/compression.c | 172 +-

Re: [PATCH v9 0/6] Btrfs: implement swap file support

2018-10-22 Thread Omar Sandoval
On Fri, Oct 19, 2018 at 05:43:18PM +0200, David Sterba wrote: > On Thu, Sep 27, 2018 at 11:17:32AM -0700, Omar Sandoval wrote: > > From: Omar Sandoval > > This series implements swap file support for Btrfs. > > > > Changes from v8 [1]: > > > > - Fixed a b

Re: [PATCH 10/10] btrfs-progs: check: Fix wrong error message in case of corrupted bitmap

2018-10-04 Thread Omar Sandoval
On Mon, Oct 01, 2018 at 05:46:21PM +0300, Nikolay Borisov wrote: > Similarly to the fix in e444c7bfa65f ("btrfs-progs: check: Fix wrong > error message in case of corrupted extent") this commits addresses the > same problem but for corrupted bitmap objects. Oops. Reviewe

Re: [PATCH 08/10] btrfs-progs: check: Add support for freespace tree fixing

2018-10-04 Thread Omar Sandoval
t; functions. And then introducing a wrapper function to contains the > existing check_space_cache and the newly introduced repair code. > Finally, it's important to note that FST repair code first clears the > existing FST in case of any problem found and rebuilds it from scratch. Revie

Re: [PATCH 07/10] btrfs-progs: Add freespace tree as compat_ro supported feature

2018-10-04 Thread Omar Sandoval
On Mon, Oct 01, 2018 at 05:46:18PM +0300, Nikolay Borisov wrote: > The RO_FREE_SPACE_TREE(_VALID) flags are required in order to be able > to open an FST filesystem in repair mode. Add them to > BTRFS_FEATURE_COMPAT_RO_SUPP. > > Signed-off-by: Nikolay Borisov > --- > ctree.h | 4 +++- > 1 file

Re: [PATCH 05/10] btrfs-progs: Pull free space tree related code from kernel

2018-10-04 Thread Omar Sandoval
On Mon, Oct 01, 2018 at 05:46:16PM +0300, Nikolay Borisov wrote: > To help implement free space tree checker in user space some kernel > function are necessary, namely iterating/deleting/adding freespace > items, some internal search functions. Functions to populate a block > group based on the

Re: [PATCH 04/10] btrfs-progs: Implement find_*_bit_le operations

2018-10-04 Thread Omar Sandoval
n machine. > This is in preparation for adding free space tree conversion support. I had to check, but it looks like these are also pulled from the kernel source, so Reviewed-by: Omar Sandoval > Signed-off-by: Nikolay Borisov > --- > kernel-lib/bitops.h | 82 > ++

Re: [PATCH 03/10] btrfs-progs: Replace homegrown bitops related functions with kernel counterparts

2018-10-02 Thread Omar Sandoval
s. Reviewed-by: Omar Sandoval > Signed-off-by: Nikolay Borisov > --- > kernel-lib/bitops.h | 142 > +--- > 1 file changed, 46 insertions(+), 96 deletions(-) > > diff --git a/kernel-lib/bitops.h b/kernel-lib/bitops.h > ind

Re: [PATCH 02/10] btrfs-progs: Add extent buffer bitmap manipulation infrastructure

2018-10-02 Thread Omar Sandoval
tions. Since in userspace we don't have to deal with page mappings > their implementation is vastly simplified by simply setting each bit in > the passed range. Reviewed-by: Omar Sandoval > Signed-off-by: Nikolay Borisov >

Re: [PATCH 01/10] btrfs-progs: Add support for freespace tree in btrfs_read_fs_root

2018-10-02 Thread Omar Sandoval
On Mon, Oct 01, 2018 at 05:46:12PM +0300, Nikolay Borisov wrote: > For completeness sake add code to btrfs_read_fs_root so that it can > handle the freespace tree. Reviewed-by: Omar Sandoval > Signed-off-by: Nikolay Borisov > --- > disk-io.c | 3 +++ > 1 file cha

Re: [PATCH v2 1/9] fstests: btrfs: _scratch_mkfs_sized fix min size without mixed option

2018-09-27 Thread Omar Sandoval
On Wed, Sep 26, 2018 at 09:34:27AM +0300, Nikolay Borisov wrote: > > > On 26.09.2018 07:07, Anand Jain wrote: > > > > > > On 09/25/2018 06:51 PM, Nikolay Borisov wrote: > >> > >> > >> On 25.09.2018 07:24, Anand Jain wrote: > >>> As of now _scratch_mkfs_sized() checks if the requested size is

Re: [PATCH] btrfs: list usage cleanup

2018-09-27 Thread Omar Sandoval
On Wed, Sep 26, 2018 at 04:35:45PM +0800, zhong jiang wrote: > Trival cleanup, list_move_tail will implement the same function that > list_del() + list_add_tail() will do. hence just replace them. > > Signed-off-by: zhong jiang > --- > fs/btrfs/send.c | 3 +-- > 1 file changed, 1 insertion(+),

[PATCH v9 6/6] Btrfs: support swap files

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval Btrfs has not allowed swap files since commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, now that the proper restrictions are in place, Btrfs can support swap files through the swap file a_ops, similar to iomap

[PATCH v9 5/6] Btrfs: rename get_chunk_map() and make it non-static

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval The Btrfs swap code is going to need it, so give it a btrfs_ prefix and make it non-static. Reviewed-by: Nikolay Borisov Signed-off-by: Omar Sandoval --- fs/btrfs/volumes.c | 29 ++--- fs/btrfs/volumes.h | 2 ++ 2 files changed, 20 insertions

[PATCH v9 4/6] Btrfs: prevent ioctls from interfering with a swap file

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval A later patch will implement swap file support for Btrfs, but before we do that, we need to make sure that the various Btrfs ioctls cannot change a swap file. When a swap file is active, we must make sure that the extents of the file are not moved and that they don't become

[PATCH v9 0/6] Btrfs: implement swap file support

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval Hi, This series implements swap file support for Btrfs. Changes from v8 [1]: - Fixed a bug in btrfs_swap_activate() which would cause us to miss some file extents if they were merged into one extent map entry. - Fixed build for !CONFIG_SWAP. - Changed all error messages

[PATCH v9 2/6] mm: export add_swap_extent()

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval Btrfs currently does not support swap files because swap's use of bmap does not work with copy-on-write and multiple devices. See commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, the swap code has a

[PATCH v9 1/6] mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval The SWP_FILE flag serves two purposes: to make swap_{read,write}page() go through the filesystem, and to make swapoff() call ->swap_deactivate(). For Btrfs, we want the latter but not the former, so split this flag into two. This makes us always call ->swap_deac

[PATCH v9 3/6] vfs: update swap_{,de}activate documentation

2018-09-27 Thread Omar Sandoval
From: Omar Sandoval The documentation for these functions is wrong in several ways: - swap_activate() is called with the inode locked - swap_activate() takes a swap_info_struct * and a sector_t * - swap_activate() can also return a positive number of extents it added itself - swap_deactivate

[PATCH] Btrfs: get rid of btrfs_symlink_aops

2018-09-24 Thread Omar Sandoval
From: Omar Sandoval The only aops we define for symlinks are identical to the aops for regular files. This has been the case since symlink support was added in commit 2b8d99a723a3 ("Btrfs: symlinks and hard links"). As far as I can tell, there wasn't a good reason to have sep

Re: [PATCH 5/6] btrfs-progs: check: Add support for freespace tree fixing

2018-09-21 Thread Omar Sandoval
On Fri, Jun 15, 2018 at 02:06:01PM +0300, Nikolay Borisov wrote: > Now that all the prerequisite code for proper support of free space > tree repair is in, it's time to wire it in. This is achieved by first > hooking the freespace tree to the __free_extent/alloc_reserved_tree_block > functions.

Re: [PATCH 4/6] btrfs-progs: Add freespace tree as compat_ro supported feature

2018-09-21 Thread Omar Sandoval
On Fri, Jun 15, 2018 at 02:06:00PM +0300, Nikolay Borisov wrote: > The RO_FREE_SPACE_TREE(_VALID) flags are required in order to be able > to open an FST filesystem in repair mode. Add them to > BTRFS_FEATURE_COMPAT_RO_SUPP. > > Signed-off-by: Nikolay Borisov > --- > ctree.h | 4 +++- > 1 file

Re: [PATCH 3/6] btrfs-progs: Pull free space tree related code from kernel

2018-09-21 Thread Omar Sandoval
On Fri, Jun 15, 2018 at 02:05:59PM +0300, Nikolay Borisov wrote: > To help implement free space tree checker in user space some kernel > function are necessary, namely iterating/deleting/adding freespace > items, some internal search functions. Functions to populate a block > group based on the

Re: [PATCH 1/6] btrfs-progs: Add support for freespace tree in btrfs_read_fs_root

2018-09-21 Thread Omar Sandoval
On Fri, Jun 15, 2018 at 02:05:57PM +0300, Nikolay Borisov wrote: > For completeness sake add code to btrfs_read_fs_root so that it can > handle the freespace tree. Reviewed-by: Omar Sandoval > Signed-off-by: Nikolay Borisov > --- > disk-io.c | 3 +++ > 1 file cha

Re: [PATCH v8 0/6] Btrfs: implement swap file support

2018-09-21 Thread Omar Sandoval
On Fri, Sep 21, 2018 at 05:17:35PM +0200, David Sterba wrote: > On Thu, Sep 20, 2018 at 10:41:24AM -0700, Omar Sandoval wrote: > > On Thu, Sep 20, 2018 at 07:22:55PM +0200, David Sterba wrote: > > > On Wed, Sep 19, 2018 at 10:02:11PM -0700, Omar Sandoval wrote: > >

Re: [PATCH v8 0/6] Btrfs: implement swap file support

2018-09-20 Thread Omar Sandoval
On Thu, Sep 20, 2018 at 07:22:55PM +0200, David Sterba wrote: > On Wed, Sep 19, 2018 at 10:02:11PM -0700, Omar Sandoval wrote: > > From: Omar Sandoval > > Changes from v7 [1]: > > > > - Expanded a few commit messages > > - Added Johannes' acked-by on patches 1

Re: [PATCH v8 6/6] Btrfs: support swap files

2018-09-20 Thread Omar Sandoval
On Thu, Sep 20, 2018 at 07:15:41PM +0200, David Sterba wrote: > On Wed, Sep 19, 2018 at 10:02:17PM -0700, Omar Sandoval wrote: > > From: Omar Sandoval > > > > Btrfs has not allowed swap files since commit 35054394c4b3 ("Btrfs: stop > > providing a bmap operati

[PATCH v8 5/6] Btrfs: rename get_chunk_map() and make it non-static

2018-09-19 Thread Omar Sandoval
From: Omar Sandoval The Btrfs swap code is going to need it, so give it a btrfs_ prefix and make it non-static. Reviewed-by: Nikolay Borisov Signed-off-by: Omar Sandoval --- fs/btrfs/volumes.c | 29 ++--- fs/btrfs/volumes.h | 2 ++ 2 files changed, 20 insertions

[PATCH v8 0/6] Btrfs: implement swap file support

2018-09-19 Thread Omar Sandoval
From: Omar Sandoval Hi, This series implements swap file support for Btrfs. Changes from v7 [1]: - Expanded a few commit messages - Added Johannes' acked-by on patches 1 and 2 - Rebased on v4.19-rc4 No functional changes. Thanks! 1: https://www.spinics.net/lists/linux-btrfs/msg81933.html

[PATCH v8 4/6] Btrfs: prevent ioctls from interfering with a swap file

2018-09-19 Thread Omar Sandoval
From: Omar Sandoval A later patch will implement swap file support for Btrfs, but before we do that, we need to make sure that the various Btrfs ioctls cannot change a swap file. When a swap file is active, we must make sure that the extents of the file are not moved and that they don't become

[PATCH v8 6/6] Btrfs: support swap files

2018-09-19 Thread Omar Sandoval
From: Omar Sandoval Btrfs has not allowed swap files since commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, now that the proper restrictions are in place, Btrfs can support swap files through the swap file a_ops, similar to iomap

[PATCH v8 1/6] mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS

2018-09-19 Thread Omar Sandoval
From: Omar Sandoval The SWP_FILE flag serves two purposes: to make swap_{read,write}page() go through the filesystem, and to make swapoff() call ->swap_deactivate(). For Btrfs, we want the latter but not the former, so split this flag into two. This makes us always call ->swap_deac

[PATCH v8 2/6] mm: export add_swap_extent()

2018-09-19 Thread Omar Sandoval
From: Omar Sandoval Btrfs currently does not support swap files because swap's use of bmap does not work with copy-on-write and multiple devices. See commit 35054394c4b3 ("Btrfs: stop providing a bmap operation to avoid swapfile corruptions"). However, the swap code has a

[PATCH v8 3/6] vfs: update swap_{,de}activate documentation

2018-09-19 Thread Omar Sandoval
From: Omar Sandoval The documentation for these functions is wrong in several ways: - swap_activate() is called with the inode locked - swap_activate() takes a swap_info_struct * and a sector_t * - swap_activate() can also return a positive number of extents it added itself - swap_deactivate

Re: [PATCH v7 2/6] mm: export add_swap_extent()

2018-09-19 Thread Omar Sandoval
On Wed, Sep 19, 2018 at 02:09:09PM -0400, Johannes Weiner wrote: > On Tue, Sep 11, 2018 at 03:34:45PM -0700, Omar Sandoval wrote: > > From: Omar Sandoval > > > > Btrfs will need this for swap file support. > > > > Signed-off-by: Omar Sandoval > > That l

Re: [PATCH v7 1/6] mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS

2018-09-19 Thread Omar Sandoval
On Wed, Sep 19, 2018 at 02:02:32PM -0400, Johannes Weiner wrote: > On Tue, Sep 11, 2018 at 03:34:44PM -0700, Omar Sandoval wrote: > > @@ -2411,8 +2412,10 @@ static int setup_swap_extents(struct > > swap_info_struct *sis, sector_t *span) > > > > if (ma

Re: [PATCH v7 0/6] Btrfs: implement swap file support

2018-09-19 Thread Omar Sandoval
On Tue, Sep 11, 2018 at 03:34:43PM -0700, Omar Sandoval wrote: > From: Omar Sandoval > > Hi, > > This series implements swap file support for Btrfs. > > Changes from v6 [1]: > > - Moved btrfs_get_chunk_map() comment to function body > - Added more comments a

Re: [PATCH 32/36] btrfs: clear delayed_refs_rsv for dirty bg cleanup

2018-09-18 Thread Omar Sandoval
On Tue, Sep 11, 2018 at 01:58:03PM -0400, Josef Bacik wrote: > We keep track of dirty bg's as a reservation in the delayed_refs_rsv, so > when we abort and we cleanup those dirty bgs we need to drop their > reservation so we don't have accounting issues and lots of scary > messages on umount.

Re: [PATCH 33/36] btrfs: only free reserved extent if we didn't insert it

2018-09-18 Thread Omar Sandoval
l > clear the reserved extent reservation, resulting in a negative > accounting of the reserved bytes for the block group and space info. > Fix this by only doing the free if we didn't successfully insert a file > extent for this extent. Reviewed-by: Omar Sandoval > Signed-off-by: Josef

Re: [PATCH 17/36] btrfs: loop in inode_rsv_refill

2018-09-18 Thread Omar Sandoval
On Tue, Sep 11, 2018 at 01:57:48PM -0400, Josef Bacik wrote: > With severe fragmentation we can end up with our inode rsv size being > huge during writeout, which would cause us to need to make very large > metadata reservations. However we may not actually need that much once > writeout is

Re: [PATCH 16/36] btrfs: run delayed iputs before committing

2018-09-18 Thread Omar Sandoval
reasons, run the delayed iputs so that any potential space is free'd up. > If there is and we freed enough we can then commit the transaction and > potentially be able to make our reservation. Reviewed-by: Omar Sandoval > Signed-off-by: Josef Bacik > --- > fs/btrfs/extent-tree.c | 9

Re: [PATCH 14/36] btrfs: reset max_extent_size properly

2018-09-18 Thread Omar Sandoval
On Tue, Sep 11, 2018 at 01:57:45PM -0400, Josef Bacik wrote: > If we use up our block group before allocating a new one we'll easily > get a max_extent_size that's set really really low, which will result in > a lot of fragmentation. We need to make sure we're resetting the > max_extent_size when

Re: [PATCH 1/4 v2] btrfs: tests: add separate stub for find_lock_delalloc_range

2018-09-17 Thread Omar Sandoval
er use, drop it an add a public wrapper for the helper needed by > tests. Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba > --- > > v2: > - add noinline_for_stack back > fs/btrfs/ctree.h | 6 -- > fs/btrfs/extent_io.c | 13 +

Re: [PATCH 4/4 v2] btrfs: tests: polish ifdefs around testing helper

2018-09-17 Thread Omar Sandoval
imize out > any code that would depend on conditions using btrfs_is_testing. > > As this is only for the testing code, drop unlikely(). Reviewed-by: Omar Sandoval > Signed-off-by: David Sterba > --- > > v2: > - remove unlikely > - simplify to: return test_bit(...) >

Re: [PATCH] btrfs: wait on caching when putting the bg cache

2018-09-12 Thread Omar Sandoval
ock group, so we're sure to be done with all IO by the time we get to > btrfs_stop_all_workers(). This fixes the panic I was seeing > consistently in testing. Reviewed-by: Omar Sandoval > Signed-off-by: Josef Bacik > --- > fs/btrfs/extent-tree.c | 1 + > 1 file changed, 1 inse

Re: [PATCH 03/36] btrfs: cleanup extent_op handling

2018-09-11 Thread Omar Sandoval
On Tue, Sep 11, 2018 at 01:57:34PM -0400, Josef Bacik wrote: > From: Josef Bacik > > The cleanup_extent_op function actually would run the extent_op if it > needed running, which made the name sort of a misnomer. Change it to > run_and_cleanup_extent_op, and move the actual cleanup work to >

Re: [PATCH 08/36] btrfs: dump block_rsv whe dumping space info

2018-09-11 Thread Omar Sandoval
v->type, (unsigned long long)rsv->size, > +(unsigned long long)rsv->reserved); How about passing a string name for each of these instead of an ID which we have to cross-reference with the source? Besides that, Reviewed-by: Omar Sandoval > + spin_unlock(>lock); >

Re: [PATCH 07/36] btrfs: check if free bgs for commit

2018-09-11 Thread Omar Sandoval
e still want to commit as we may be able to allocate a chunk to make > our reservation. So instead of just returning ENOSPC, check if we have > free block groups pending, and if so commit the transaction to allow us > to use that free space. Reviewed-by: Omar Sandoval > Si

Re: [PATCH 05/36] btrfs: only count ref heads run in __btrfs_run_delayed_refs

2018-09-11 Thread Omar Sandoval
On Tue, Sep 11, 2018 at 01:57:36PM -0400, Josef Bacik wrote: > We pick the number of ref's to run based on the number of ref heads, and > only make the decision to stop once we've processed entire ref heads, so > only count the ref heads we've run and bail once we've hit the number of > ref heads

Re: [PATCH 01/36] btrfs: add btrfs_delete_ref_head helper

2018-09-11 Thread Omar Sandoval
On Tue, Sep 11, 2018 at 01:57:32PM -0400, Josef Bacik wrote: > From: Josef Bacik > > We do this dance in cleanup_ref_head and check_ref_cleanup, unify it > into a helper and cleanup the calling functions. Reviewed-by: Omar Sandoval > Signed-off-by: Josef Bacik > --- > f

[PATCH v7 1/6] mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS

2018-09-11 Thread Omar Sandoval
From: Omar Sandoval The SWP_FILE flag serves two purposes: to make swap_{read,write}page() go through the filesystem, and to make swapoff() call ->swap_deactivate(). For Btrfs, we want the latter but not the former, so split this flag into two. This makes us always call ->swap_deac

[PATCH v7 0/6] Btrfs: implement swap file support

2018-09-11 Thread Omar Sandoval
From: Omar Sandoval Hi, This series implements swap file support for Btrfs. Changes from v6 [1]: - Moved btrfs_get_chunk_map() comment to function body - Added more comments about pinned block group/device rbtree - Fixed bug in patch 4 which broke resize Based on v4.19-rc3. Thanks! 1

  1   2   3   4   5   6   7   8   9   >