Re: [PATCH 3/6] Btrfs: move get root of btrfs_search_slot to a helper

2018-05-16 Thread Nikolay Borisov
for this function but I don't really have a better suggestions which would be more specific. For the code (the changelog should be more explicit): Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > fs/btrfs/ctree.c | 112 > +-

Re: [PATCH] btrfs-progs: remove BTRFS_LIST_LAYOUT_RAW

2018-05-16 Thread Nikolay Borisov
On 15.05.2018 12:17, Gu Jinxiang wrote: > Since > commit 9005b603d723 ("btrfs-progs: use libbtrfsutil for subvol show"), > BTRFS_LIST_LAYOUT_RAW has no usage. > So, remove it. > > Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> Reviewed-by: Nikolay Borisov &

Re: [PATCH] btrfs: Skip some btrfs_cross_ref_exist() check in nocow path

2018-05-16 Thread Nikolay Borisov
On 16.05.2018 11:28, Ethan Lien wrote: > In nocow path, we check if the extent is snapshotted in > btrfs_cross_ref_exist(). We can do the similar check earlier and avoid > unnecessary search into extent tree. > > Signed-off-by: Ethan Lien If this is supposed to be a

[PATCH] btrfs: Remove stale comment about select_delayed_ref

2018-05-17 Thread Nikolay Borisov
select_delayed_ref really just gets the next delayed ref which has to be processed - either an add ref or drop ref. We never go back for anything. So the comment is actually bogus, just remove it. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- fs/btrfs/extent-tree.c | 4

Re: [PATCH v2] btrfs: use kvzalloc for EXTENT_SAME temporary data

2018-05-17 Thread Nikolay Borisov
eed only inside btrfs_extent_same and > reused for all the ranges. > > Signed-off-by: David Sterba <dste...@suse.com> LGTM: Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > > Based on git://github.com/kdave/btrfs-devel.git ext/timofey/dedupe-16mb-limit >

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

2018-05-15 Thread Nikolay Borisov
On 15.05.2018 11:48, Qu Wenruo wrote: static inline int inode_need_compress(struct inode *inode, u64 start, u64 end) { struct btrfs_fs_info *fs_info

Re: [PATCH 6/6] Btrfs: remove always true check in unlock_up

2018-05-16 Thread Nikolay Borisov
On 15.05.2018 20:52, Liu Bo wrote: > @path->lock[i] is always true at this point. You must explain why it's true. The reason is since at the beginning of the for loop the check is performed : if (!path->locks[i]) break; Codewise it's ok: Reviewed-by: Nikolay Boris

Re: [PATCH v2 1/3] btrfs: balance: prefix kernel logs

2018-05-16 Thread Nikolay Borisov
nd.j...@oracle.com> Straightforward: Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > v1-v2: Change log update. > fs/btrfs/volumes.c | 34 -- > 1 file changed, 20 insertions(+), 14 deletions(-) > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs

Re: [PATCH v2 2/3] btrfs: balance: add args info during start and resume

2018-05-16 Thread Nikolay Borisov
On 16.05.2018 05:51, Anand Jain wrote: > Balance args info is an important information to be reviewed for the > system audit. So this patch adds it to the kernel log. > > Example: > > -> btrfs bal start -dprofiles='raid1|single',convert=raid5 > -mprofiles='raid1|single',convert=raid5 /btrfs >

[PATCH 0/4] Cleanup alloc_reserved_tree_block signature

2018-05-21 Thread Nikolay Borisov
functional changes but makes the code easier to follow. Also it has survived 2 xfstest runs. Nikolay Borisov (4): btrfs: Remove fs_info argument from alloc_reserved_tree_block btrfs: Simplify alloc_reserved_tree_block interface btrfs: Pass btrfs_delayed_extent_op to alloc_reserved_tree_block

Re: [PATCH] btrfs: remove unnecessary if judge

2018-05-21 Thread Nikolay Borisov
On 21.05.2018 12:32, Gu Jinxiang wrote: > Since add_excluded_extent always returns 0, > no need to judge ret. This patch is conceptually wrong because: a). Currently exclude_super_stripes is in fact buggy since it calls set_extent_bits which *may* fail, yet the return value is completely

[PATCH 2/4] btrfs: Simplify alloc_reserved_tree_block interface

2018-05-21 Thread Nikolay Borisov
ith a more verbose name - extent_key. 2. Now that we have a reference to the node in alloc_reserved_tree_block the delayed_tree_ref struct can be referenced inside the function and this enable removing the "ref->level", "parent" and "ref_root" arguments. Signed-off-by:

[PATCH 1/4] btrfs: Remove fs_info argument from alloc_reserved_tree_block

2018-05-21 Thread Nikolay Borisov
This function already takes a transaction handle which contains a reference to the fs_info. So use this and remove the extra argument. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- fs/btrfs/extent-tree.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs

[PATCH 3/4] btrfs: Pass btrfs_delayed_extent_op to alloc_reserved_tree_block

2018-05-21 Thread Nikolay Borisov
Instead of taking only specific member of this structure, which results in 2 extra arguments, just take the delayed_extent_op struct and reference the arguments inside the functions. No functional changes. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- fs/btrfs/extent-tree.

[PATCH 4/4] btrfs: Streamline shared ref check in alloc_reserved_tree_block

2018-05-21 Thread Nikolay Borisov
Instead of setting "parent" to ref->parent only when dealing with a shared ref and subsequently performing another check to see if (parent > 0), check the "node->type" directly and act accordingly. This makes the code more streamline. No functional changes. Signed-o

Re: [PATCH 1/2] btrfs: handle failures of set_extent_bits in add_excluded_extent

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 12:46, Gu Jinxiang wrote: > set_extent_bits may return 0/-EEXIST, so return the result in > add_excluded_extent. > > Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > fs/btrfs/extent-tre

Re: [PATCH v2 0/6] btrfs_search_slot cleanups

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 15:02, David Sterba wrote: > On Tue, May 22, 2018 at 07:05:14PM +0800, Su Yue wrote: >> Hi Liu and David, >> During my local xfstests on kdave/for-next, btrfs/139 failed and >> btrfs BUG_ON due to qgroup rescan. >> The bisect result is commit 560215eb3f32("Merge branch >>

Re: [PATCH] Btrfs: fix error handling in btrfs_truncate()

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 14:53, David Sterba wrote: > On Fri, May 18, 2018 at 02:43:02PM -0700, Omar Sandoval wrote: >> From: Omar Sandoval >> >> Jun Wu at Facebook reported that an internal service was seeing a return >> value of 1 from ftruncate() on Btrfs when compression is enabled.

Re: [PATCH 2/2] btrfs: propagate failures of __exclude_logged_extent to upper caller

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 12:46, Gu Jinxiang wrote: > Function btrfs_exclude_logged_extents may call __exclude_logged_extent > which may fail. > Propagate the failures of __exclude_logged_extent to upper caller. > > Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> Reviewed-by: N

Re: [PATCH v3 1/2] btrfs: qgroup: Search commit root for rescan to avoid missing extent

2018-05-23 Thread Nikolay Borisov
gt; This is due to the fact that we're always searching commit root for > btrfs_find_all_roots() at qgroup_rescan_leaf(), but the leaf we get is > from current transaction, not commit root. > > And if our tree blocks get modified in current transaction, we won't > find any owner i

Re: [PATCH] btrfs: delayed-ref: simplify btrfs_add_delayed_tree_ref()

2018-05-23 Thread Nikolay Borisov
ommit 5a5003df98d5 ("btrfs: delayed-ref: double > free in btrfs_add_delayed_tree_ref()") and frees the right head_ref. > No functional change. > > Signed-off-by: Su Yue <suy.f...@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > This patch is based o

Re: [PATCH] Btrfs: implement unlocked buffered write

2018-05-23 Thread Nikolay Borisov
On 23.05.2018 09:37, Christoph Hellwig wrote: > On Tue, May 22, 2018 at 02:31:36PM -0400, Chris Mason wrote: >>> And what protects two writes from interleaving their results now? >> >> page locks...ish, we at least won't have results interleaved in a single >> page. For btrfs it'll actually be

Re: [PATCH v2] btrfs: handle failures of set_extent_bits in add_excluded_extent

2018-05-23 Thread Nikolay Borisov
On 23.05.2018 06:37, Gu Jinxiang wrote: > set_extent_bits may fail, return the result in add_excluded_extent. > > Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > Changelog: > v2-v1: > 1.remove goto to make t

Re: [PATCH 2/2] Btrfs: fix dedupe vs chattr NODATASUM race

2018-05-23 Thread Nikolay Borisov
his was correct until a recent > change. > > Fixes: 0a38effca37c ("Btrfs: split btrfs_extent_same") > Signed-off-by: Omar Sandoval <osan...@fb.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > fs/btrfs/ioctl.c | 13 +++-- > 1 file cha

Re: [PATCH 1/2] Btrfs: fix clone vs chattr NODATASUM race

2018-05-23 Thread Nikolay Borisov
n end up with a party > checksummed file. > > Fixes: 0e7b824c4ef9 ("Btrfs: don't make a file partly checksummed through > file clone") > Signed-off-by: Omar Sandoval <osan...@fb.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > fs/btrfs

Re: csum failed root raveled during balance

2018-05-23 Thread Nikolay Borisov
On 22.05.2018 23:05, ein wrote: > Hello devs, > > I tested BTRFS in production for about a month: > > 21:08:17 up 34 days, 2:21, 3 users, load average: 0.06, 0.02, 0.00 > > Without power blackout, hardware failure, SSD's SMART is flawless etc. > The tests ended with: > > root@node0:~#

Re: csum failed root raveled during balance

2018-05-23 Thread Nikolay Borisov
On 23.05.2018 11:03, ein wrote: > On 05/23/2018 08:32 AM, Nikolay Borisov wrote: > > Nikolay, thank you for the answer. > >>> [...] >>> root@node0:~# dmesg | grep BTRFS | grep warn >>> 185:980:[2927472.393557] BTRFS warning (device dm-0): csum failed

Re: [RFC PATCH v4 3/6] Btrfs: push EXCL_OP set into btrfs_rm_device()

2018-05-25 Thread Nikolay Borisov
s easier. > > Signed-off-by: Omar Sandoval <osan...@fb.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > fs/btrfs/ioctl.c | 13 - > fs/btrfs/volumes.c | 4 > 2 files changed, 4 insertions(+), 13 deletions(-) > > diff --git a

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

2018-05-25 Thread Nikolay Borisov
or swap files over NFS. > > Signed-off-by: Omar Sandoval <osan...@fb.com> Generally looks good: Reviewed-by: Nikolay Borisov <nbori...@suse.com> just one cleanup suggestion, see below. > --- > include/linux/swap.h | 13 +++-- > mm/page_io.c |

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

2018-05-25 Thread Nikolay Borisov
On 25.05.2018 00:41, Omar Sandoval wrote: > From: Omar Sandoval <osan...@fb.com> > > The Btrfs swap code is going to need it, so give it a btrfs_ prefix and > make it non-static. > > Signed-off-by: Omar Sandoval <osan...@fb.com> Reviewed-by: Nikolay Borisov <n

Re: [RFC PATCH v4 6/6] Btrfs: support swap files

2018-05-25 Thread Nikolay Borisov
On 25.05.2018 00:41, Omar Sandoval wrote: > From: Omar Sandoval > > Implement the swap file a_ops on Btrfs. Activation needs to make sure > that the file can be used as a swap file, which currently means it must > be fully allocated as nocow with no compression on one device.

Re: [RFC PATCH v4 2/6] vfs: update swap_{,de}activate documentation

2018-05-25 Thread Nikolay Borisov
> - swap_activate() can also return a positive number of extents it added > itself > - swap_deactivate() does not return anything > > Signed-off-by: Omar Sandoval <osan...@fb.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > Documentation/fi

Re: [PATCH 2/4] btrfs: remove the wait ordered logic in the log_one_extent path

2018-05-26 Thread Nikolay Borisov
On 23.05.2018 18:58, Josef Bacik wrote: > From: Josef Bacik > > Since we are waiting on all ordered extents at the start of the fsync() > path we don't need to wait on any logged ordered extents, and we don't > need to look up the checksums on the ordered extents as they will >

Re: [PATCH 1/4] btrfs: always wait on ordered extents at fsync time

2018-05-24 Thread Nikolay Borisov
On 24.05.2018 13:49, Filipe Manana wrote: > On Wed, May 23, 2018 at 4:58 PM, Josef Bacik wrote: >> From: Josef Bacik >> >> There's a priority inversion that exists currently with btrfs fsync. In >> some cases we will collect outstanding ordered extents

Re: [PATCH v4 3/3] btrfs: Do super block verification before writing it to disk

2018-05-25 Thread Nikolay Borisov
cause is still unknown, at least detect it and prevent further > corruption. > > Reported-by: Ken Swenson <f...@imo.uto.moe> > Reported-by: Ben Parsons <9parso...@gmail.com> > Signed-off-by: Qu Wenruo <w...@suse.com> Reviewed-by: Nikolay Borisov <nbori...@suse.co

Re: [PATCH] Btrfs: fix the corruption by reading stale btree blocks

2018-05-18 Thread Nikolay Borisov
On 18.05.2018 17:06, David Sterba wrote: > On Fri, May 18, 2018 at 09:15:16PM +0800, Liu Bo wrote: Doesn't this warrant a stable tag and Fixes: 5bdd3536cbbe ("Btrfs: Fix block generation verification race") >>> >>> The patch will not apply to < 4.16 as it depends on the addition of >>>

[PATCH] btrfs: Document __btrfs_inc_extent_ref

2018-05-18 Thread Nikolay Borisov
Here is a doc-only patch which tires to deobfuscate the terra-incognita that arguments for delayed refs are. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- Hello, This patch needs revieweing since I'm not entirely sure I managed to capture the semantics of the "parent&

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

2018-05-15 Thread Nikolay Borisov
On 15.05.2018 10:36, Qu Wenruo wrote: > As btrfs(5) specified: > > Note > If nodatacow or nodatasum are enabled, compression is disabled. > > If NODATASUM or NODATACOW set, we should not compress the extent. > > Normally NODATACOW is detected properly in run_delalloc_range() so >

Re: [PATCH 2/2] btrfs: lzo: Avoid decompressing obviously corrupted data

2018-05-15 Thread Nikolay Borisov
On 15.05.2018 11:32, Qu Wenruo wrote: > > > On 2018年05月15日 16:05, Nikolay Borisov wrote: >> >> >> On 15.05.2018 10:36, Qu Wenruo wrote: >>> Unlike zlib decompression, lzo decompression doesn't need any >>> initialization, thus we can't de

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

2018-05-15 Thread Nikolay Borisov
On 15.05.2018 11:30, Qu Wenruo wrote: > > > On 2018年05月15日 16:21, Nikolay Borisov wrote: >> >> >> On 15.05.2018 10:36, Qu Wenruo wrote: >>> As btrfs(5) specified: >>> >>> Note >>> If nodatacow or nodatasum are enabled, com

Re: [PATCH 2/2] btrfs: always wait on ordered extents at fsync time

2018-05-23 Thread Nikolay Borisov
On 23.05.2018 18:38, Josef Bacik wrote: > It's just removing all of the code that is no longer needed with the > unconditional wait_ordered_extents, it's not that complicated. Just because something is painfully obvious to you doesn't mean it's the same for others. Especially given the current

Re: [PATCH] Btrfs: fix error handling in btrfs_truncate()

2018-05-21 Thread Nikolay Borisov
ywhere else. > > Fixes: ddfae63cc8e0 ("btrfs: move btrfs_truncate_block out of trans handle") > Reported-by: Jun Wu <qu...@fb.com> > Signed-off-by: Omar Sandoval <osan...@fb.com> Reviewed-by: Nikolay Borisov <nbori...@suse.com> > --- > T

Re: [PATCH] btrfs: Use btrfs_add_unused_bgs() to replace open code

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 10:29, Qu Wenruo wrote: > Introduce a small helper, btrfs_add_unused_bgs(), to accquire needed This function name sounds a bit awkard, mainly because you use the plural form. How about btrfs_mark_bg_unused() ? The name seems more unambiguous. > locks and add a block group to

Re: [PATCH] btrfs: Use btrfs_add_unused_bgs() to replace open code

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 10:45, Qu Wenruo wrote: > > > On 2018年05月22日 15:37, Nikolay Borisov wrote: >> >> >> On 22.05.2018 10:29, Qu Wenruo wrote: >>> Introduce a small helper, btrfs_add_unused_bgs(), to accquire needed >> >> This function name sounds a

Re: [PATCH] btrfs: handle failures of set_extent_bits in add_excluded_extent

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 06:51, Gu Jinxiang wrote: > set_extent_bits may return 0/-EEXIST, so return the result in > add_excluded_extent. And handle the failures in upper callers. > > Caller of add_excluded_extent and failure process currently: > exclude_super_stripes > <- btrfs_make_block_group

Re: [PATCH v2] btrfs: Use btrfs_mark_bg_unused() to replace open code

2018-05-22 Thread Nikolay Borisov
On 22.05.2018 11:43, Qu Wenruo wrote: > Introduce a small helper, btrfs_mark_bg_unused(), to accquire needed > locks and add a block group to unused_bgs list. > > No functional modification, and only 3 callers are involved.> > Signed-off-by: Qu Wenruo <w...@suse.com&g

[PATCH v2] btrfs-progs: Add delayed refs infrastructure

2018-06-08 Thread Nikolay Borisov
in userspace. 3. Removed code which deals with data refs - delayed refs in user space are going to be used only for cowonly trees. Signed-off-by: Nikolay Borisov --- V2: * removed definitions of delayed data ref structure. Makefile | 3 +- ctree.h | 3 + delayed-ref.c | 608

[PATCH v2] btrfs-progs: Remove old delayed refs infrastructure

2018-06-08 Thread Nikolay Borisov
Given that the new delayed refs infrastructure is implemented and wired up, there is no point in keeping the old code. So just remove it. Signed-off-by: Nikolay Borisov --- V2: * Remove fs_info->pending_del references in disk-io.c . This prevented compilation. ctree.h |

Re: [PATCH 00/15] Add delayed-refs support to btrfs-progs

2018-06-08 Thread Nikolay Borisov
On 8.06.2018 16:50, Qu Wenruo wrote: > details? > Personally speaking, I'd like to avoid introducing complex delayed-ref > into btrfs-progs if possible. > > And in my (possibly wrong) understanding, the main purpose of > delayed-ref is to reduce the race on extent tree, thus to improve >

[PATCH 01/15] btrfs-progs: Remove root argument from pin_down_bytes

2018-06-08 Thread Nikolay Borisov
This argument is used to obtain a reference to fs_info, which can already be done from the passed trans handle, so use that instead. This is in preparation for delayed refs support. Signed-off-by: Nikolay Borisov --- extent-tree.c | 9 - 1 file changed, 4 insertions(+), 5 deletions

[PATCH 02/15] btrfs-progs: Remove root argument from btrfs_del_csums

2018-06-08 Thread Nikolay Borisov
It's not needed, since we can obtain a reference to fs_info from the passed transaction handle. This is needed by delayed refs code. Signed-off-by: Nikolay Borisov --- btrfs-corrupt-block.c | 2 +- ctree.h | 3 +-- extent-tree.c | 2 +- file-item.c | 20

[PATCH 09/15] btrfs-progs: Always pass 0 for offset when calling btrfs_free_extent for btree blocks.

2018-06-08 Thread Nikolay Borisov
not offset. So these are just leftovers with no semantic meaning. Fix this by passing 0. Signed-off-by: Nikolay Borisov --- ctree.c | 4 ++-- extent-tree.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ctree.c b/ctree.c index 8f3338b4693a..d8a6883aa85f 1006

[PATCH 14/15] btrfs-progs: Wire up delayed refs

2018-06-08 Thread Nikolay Borisov
, since it's not always obvious (those call sites were derived empirically by running and debugging existing tests) 4. Correctly flagging the transaction in which we are reinitialising the extent tree. Signed-off-by: Nikolay Borisov --- check/main.c | 3 +- extent-tree.c | 166

[PATCH 07/15] btrfs-progs: Remove root argument from __free_extent

2018-06-08 Thread Nikolay Borisov
This argument is no longer used in this function so remove it. Signed-off-by: Nikolay Borisov --- extent-tree.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index 9132cb3f8e15..c16bd85e92be 100644 --- a/extent-tree.c +++ b/extent

[PATCH 15/15] btrfs-progs: Remove old delayed refs infrastructure

2018-06-08 Thread Nikolay Borisov
Given that the new delayed refs infrastructure is implemented and wired up, there is no point in keeping the old code. So just remove it. Signed-off-by: Nikolay Borisov --- ctree.h | 2 - extent-tree.c | 137 -- 2 files changed

[PATCH 00/15] Add delayed-refs support to btrfs-progs

2018-06-08 Thread Nikolay Borisov
fsck and misc tests + fuzz tests apart from fuzz-003/007/009 - but those fail without this series so it's unlikely it's caused by it. Nikolay Borisov (15): btrfs-progs: Remove root argument from pin_down_bytes btrfs-progs: Remove root argument from btrfs_del_csums btrfs-progs: Add functions

[PATCH 11/15] btrfs-progs: Add delayed refs infrastructure

2018-06-08 Thread Nikolay Borisov
in userspace. 3. Removed code which deals with data refs - delayed refs in user space are going to be used only for cowonly trees. Signed-off-by: Nikolay Borisov --- Makefile | 3 +- ctree.h | 3 + delayed-ref.c | 608 ++ delayed

[PATCH 05/15] btrfs-progs: Make update_block_group take fs_info instead of root

2018-06-08 Thread Nikolay Borisov
This is in preparation of delayed refs code. Signed-off-by: Nikolay Borisov --- extent-tree.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index 07b5fb99e8cf..6e7a19323efc 100644 --- a/extent-tree.c +++ b/extent-tree.c

[PATCH 06/15] btrfs-progs: check: Drop trans/root arguments from free_extent_hook

2018-06-08 Thread Nikolay Borisov
They are not really needed, what free_extent_hook wants is really a pointer to fs_info so give it to it directly. This is in preparation of delayed refs code. Signed-off-by: Nikolay Borisov --- check/main.c | 5 ++--- ctree.h | 3 +-- extent-tree.c | 4 ++-- 3 files changed, 5 insertions

[PATCH 03/15] btrfs-progs: Add functions to modify the used space by a root

2018-06-08 Thread Nikolay Borisov
Pull the necessary function, excluding locking. Required to enable integration of delayed refs. Signed-off-by: Nikolay Borisov --- ctree.c | 12 1 file changed, 12 insertions(+) diff --git a/ctree.c b/ctree.c index 2c51580fec65..7b74716bf92f 100644 --- a/ctree.c +++ b/ctree.c

[PATCH 10/15] btrfs-progs: Add boolean to signal whether we are re-initing extent tree

2018-06-08 Thread Nikolay Borisov
Add a boolean to record whether the extent tree is being re-initialised in the current transaction. This is going to be needed by the delayed refs code. Signed-off-by: Nikolay Borisov --- transaction.c | 1 + transaction.h | 1 + 2 files changed, 2 insertions(+) diff --git a/transaction.c b

[PATCH 04/15] btrfs-progs: Refactor the root used bytes are updated

2018-06-08 Thread Nikolay Borisov
Instead of updating this during update_block_group, move the updating code at the places where we free/allocate a block. This resembles the current state of the kernel code. This is in prep for delayed refs. Signed-off-by: Nikolay Borisov --- ctree.c | 13 + extent-tree.c | 8

[PATCH 13/15] btrfs-progs: Add alloc_reserved_tree_block2 function

2018-06-08 Thread Nikolay Borisov
This is a simple adapter function to convert the delayed-refs structures to the current arguments of alloc_reserved_tree_block. Signed-off-by: Nikolay Borisov --- extent-tree.c | 24 1 file changed, 24 insertions(+) diff --git a/extent-tree.c b/extent-tree.c index

[PATCH 12/15] btrfs-progs: Add __free_extent2 function

2018-06-08 Thread Nikolay Borisov
This is a simple adapter to convert the arguments delayed ref arguments to the existing arguments of __free_extent. Signed-off-by: Nikolay Borisov --- extent-tree.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/extent-tree.c b/extent-tree.c index aff00e536c9c..8789a43c7fea

Re: [PATCH] btrfs: Fix a C compliance issue

2018-06-16 Thread Nikolay Borisov
On 16.06.2018 01:36, Bart Van Assche wrote: > The C programming language does not allow to use preprocessor statements > inside macro arguments (pr_info() is defined as a macro). Hence rework > the pr_info() statement in btrfs_print_mod_info() such that it becomes > compliant. This patch allows

Re: [PATCH] btrfs: Fix a C compliance issue

2018-06-18 Thread Nikolay Borisov
On 18.06.2018 12:26, David Sterba wrote: > On Sat, Jun 16, 2018 at 01:28:13PM +0300, Nikolay Borisov wrote: >> >> >> On 16.06.2018 01:36, Bart Van Assche wrote: >>> The C programming language does not allow to use preprocessor statements >>> insid

[PATCH 2/3] btrfs: Document __btrfs_inc_extent_ref

2018-06-18 Thread Nikolay Borisov
Here is a doc-only patch which tires to deobfuscate the terra-incognita that arguments for delayed refs are. Signed-off-by: Nikolay Borisov --- fs/btrfs/extent-tree.c | 34 ++ 1 file changed, 34 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent

[PATCH 1/3] btrfs: Remove fs_info argument from __btrfs_inc_extent_ref

2018-06-18 Thread Nikolay Borisov
This function already takes a transaction which holds a reference to the fs_info struct. Use that reference and remove the extra arg. No functional changes. Signed-off-by: Nikolay Borisov --- fs/btrfs/extent-tree.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff

[PATCH 3/3] btrfs: Fix comment in lookup_inline_extent_backref

2018-06-18 Thread Nikolay Borisov
The comment wrongfully states that the owner parameter is the level of the parent block. In fact owner is the level of the current block and by adding 1 to it we can eventually get to the parent/root. Signed-off-by: Nikolay Borisov --- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion

[PATCH 0/3] Cleanups around extent increment

2018-06-18 Thread Nikolay Borisov
patch fixes a comment in lookup_inline_extent_backref which transpired while Jeff was revieweing the documentation patch. Nikolay Borisov (3): btrfs: Remove fs_info argument from __btrfs_inc_extent_ref btrfs: Document __btrfs_inc_extent_ref btrfs: Fix comment

[PATCH] btrfs-progs: Check factor out root parsing from check_chunks_and_extents

2018-06-18 Thread Nikolay Borisov
ich always releases the path avoids this problem entirely. Signed-off-by: Nikolay Borisov --- check/main.c | 141 +++ 1 file changed, 85 insertions(+), 56 deletions(-) diff --git a/check/main.c b/check/main.c index a4d6855dccbf..fb5c86df2

[PATCH] btrfs-progs: check: Fix wrong root parameter of btrfs_next_leaf call

2018-06-18 Thread Nikolay Borisov
sed root is only passed to reada_for_search, where it's used to reference the fs_info. Nevertheless the code is wrong and at the very least misleading, so fix it by passing the correct root. Signed-off-by: Nikolay Borisov --- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH] btrfs: Deduplicate extent_buffer init code

2018-06-18 Thread Nikolay Borisov
in the abstraction hierarchy of operations. This patch solves this by simply moving this init code in btrfs_init_new_buffer, since this is the function which initializes a newly allocated extent buffer. No functional changes. Signed-off-by: Nikolay Borisov --- fs/btrfs/ctree.c | 29

Re: [PATCH v2] btrfs: Rewrite retry logic in do_chunk_alloc

2018-06-13 Thread Nikolay Borisov
On 18.04.2018 10:27, Nikolay Borisov wrote: > do_chunk_alloc implements logic to detect whether there is currently > pending chunk allocation (by means of space_info->chunk_alloc being > set) and if so it loops around to the 'again' label. Additionally, > based on the state of

Re: [PATCH] btrfs: Document __btrfs_inc_extent_ref

2018-06-13 Thread Nikolay Borisov
On 18.05.2018 16:12, Nikolay Borisov wrote: > Here is a doc-only patch which tires to deobfuscate the terra-incognita > that arguments for delayed refs are. > > Signed-off-by: Nikolay Borisov > --- > Hello, > > This patch needs revieweing since I'm not entirely s

[PATCH 2/6] btrfs-progs: Add extent buffer bitmap manipulation infrastructure

2018-06-15 Thread Nikolay Borisov
is vastly simplified by simply setting each bit in the passed range. Signed-off-by: Nikolay Borisov --- extent_io.c | 39 +++ extent_io.h | 15 +++ 2 files changed, 54 insertions(+) diff --git a/extent_io.c b/extent_io.c index 198492699438

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

2018-06-15 Thread Nikolay Borisov
eliminated (i.e free_space_lock). It supports reading/writing of both bitmap and extent based FST trees. Signed-off-by: Nikolay Borisov --- ctree.c | 77 + ctree.h | 4 + free-space-tree.c | 893 +- free-space-tree.h

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

2018-06-15 Thread Nikolay Borisov
For completeness sake add code to btrfs_read_fs_root so that it can handle the freespace tree. Signed-off-by: Nikolay Borisov --- disk-io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/disk-io.c b/disk-io.c index 8da6e3ce5fc8..9ad826b83b3e 100644 --- a/disk-io.c +++ b/disk-io.c

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

2018-06-15 Thread Nikolay Borisov
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. Signed-off-by: Nikolay Borisov --- check/main.c | 61

[PATCH 0/6] Freespace tree repair support

2018-06-15 Thread Nikolay Borisov
not that big and should be fairly easy to review. Patch 6 is a test-case which creates a filesystem with FST enabled, populates it with some files and then corrupts a bitmap and an extent records and tries to repair them. It's passing for me. Nikolay Borisov (6): btrfs-progs: Add support

[PATCH 6/6] btrfs-progs: tests: Test for FST corruption detection/repair

2018-06-15 Thread Nikolay Borisov
Simple test case which preps a filesystem, then corrupts the FST and finally repairs it. Tests both extent based and bitmap based FSTs. Signed-off-by: Nikolay Borisov --- tests/fsck-tests/035-freespacetree-repair/test.sh | 79 +++ 1 file changed, 79 insertions(+) create

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

2018-06-15 Thread Nikolay Borisov
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 changed, 3 insertions(+), 1 deletion(-) diff --git a/ctree.h b/ctree.h index

Re: [PATCH 1/3] btrfs: Remove fs_info argument from __btrfs_inc_extent_ref

2018-06-19 Thread Nikolay Borisov
On 19.06.2018 22:31, Jeff Mahoney wrote: > I like the idea here. I wasn't sold at first, but I think if we can > standardize on taking only a trans handle when one is required and both > a trans and fs_info when it's optional, it'll make the code clearer. > This cleanup can percolate up the

Re: [PATCH] btrfs-progs: Check factor out root parsing from check_chunks_and_extents

2018-06-18 Thread Nikolay Borisov
On 19.06.2018 05:18, Su Yue wrote: > > > On 06/18/2018 07:10 PM, Nikolay Borisov wrote: >> check_chunks_and_extents does quite a number of distinct things. The >> first of those is going through all root items in the root tree and >> classify every root dep

Re: [PATCH v3] fstests: btrfs: Test if btrfs will corrupt nodatasum compressed extent when replacing device

2018-06-14 Thread Nikolay Borisov
On 14.06.2018 10:04, Qu Wenruo wrote: > > > On 2018年06月14日 14:45, Nikolay Borisov wrote: >> >> >> On 14.06.2018 09:30, Qu Wenruo wrote: >>> This is a long existing bug (from 2012) but exposed by a reporter >>> recently, that when compressed exten

Re: [PATCH v3] fstests: btrfs: Test if btrfs will corrupt nodatasum compressed extent when replacing device

2018-06-14 Thread Nikolay Borisov
Reported-by: James Harvey > Signed-off-by: Qu Wenruo Codewise lgtm: Reviewed-by: Nikolay Borisov However, I'm having a bit of trouble reconciling the explanation so bear with me, please look below. > > changelog: > v2: > Now the fix patch is no longer RFC. > R

Re: [PATCH 02/15] btrfs-progs: Remove root argument from btrfs_del_csums

2018-06-11 Thread Nikolay Borisov
On 11.06.2018 07:46, Qu Wenruo wrote: > > > On 2018年06月08日 20:47, Nikolay Borisov wrote: >> It's not needed, since we can obtain a reference to fs_info from the >> passed transaction handle. This is needed by delayed refs code. > > This looks a little too aggress

Re: [PATCH 06/15] btrfs-progs: check: Drop trans/root arguments from free_extent_hook

2018-06-11 Thread Nikolay Borisov
On 11.06.2018 07:55, Qu Wenruo wrote: > > > On 2018年06月08日 20:47, Nikolay Borisov wrote: >> They are not really needed, what free_extent_hook wants is really a >> pointer to fs_info so give it to it directly. This is in preparation >> of delayed refs c

Re: [PATCH 07/15] btrfs-progs: Remove root argument from __free_extent

2018-06-11 Thread Nikolay Borisov
On 11.06.2018 07:58, Qu Wenruo wrote: > > > On 2018年06月08日 20:47, Nikolay Borisov wrote: >> This argument is no longer used in this function so remove it. > > The same concern about the aggressive removal of fs_info. > > I would completely accept if it's o

Re: [PATCH 11/15] btrfs-progs: Add delayed refs infrastructure

2018-06-11 Thread Nikolay Borisov
On 11.06.2018 08:20, Qu Wenruo wrote: > > > On 2018年06月08日 20:47, Nikolay Borisov wrote: >> This commit pulls those portions of the kernel implementation of >> delayed refs which are necessary to have them working in user-space. >> I've done the following modificat

Re: [PATCH 02/15] btrfs-progs: Remove root argument from btrfs_del_csums

2018-06-11 Thread Nikolay Borisov
On 11.06.2018 10:40, Qu Wenruo wrote: > > > On 2018年06月11日 15:02, Nikolay Borisov wrote: >> >> >> On 11.06.2018 07:46, Qu Wenruo wrote: >>> >>> >>> On 2018年06月08日 20:47, Nikolay Borisov wrote: >>>> It's not needed, since we

Re: [PATCH 02/15] btrfs-progs: Remove root argument from btrfs_del_csums

2018-06-11 Thread Nikolay Borisov
On 11.06.2018 11:08, Qu Wenruo wrote: > > > On 2018年06月11日 15:48, Nikolay Borisov wrote: >> >> >> On 11.06.2018 10:40, Qu Wenruo wrote: >>> >>> >>> On 2018年06月11日 15:02, Nikolay Borisov wrote: >>>> >>>> >>>

Re: [PATCH 2/2] btrfs: Refactor running of delayed inode items during transaction commit

2018-05-28 Thread Nikolay Borisov
On 28.05.2018 11:35, Nikolay Borisov wrote: > > > On 28.05.2018 11:21, Misono Tomohiro wrote: >> Hello, >> >> I found current misc-next sometimes fails btrfs/152 when the number >> of cpu is >= 4 in my vm and git bisect points this commit. >>

[PATCH 11/11] btrfs-progs: Remove fs_info argument from write_ctree_super

2018-05-28 Thread Nikolay Borisov
This function already takes a transaction handle which has a reference to the fs_info, so use that to obtain it. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- disk-io.c | 6 +++--- disk-io.h | 3 +-- transaction.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-)

[PATCH 00/11] Summer argument cleanup

2018-05-28 Thread Nikolay Borisov
in this series makes it identical to the kernel one. Nikolay Borisov (11): btrfs-progs: check: Remove root argument from delete_extent_records btrfs-progs: check: Remove root parameter from btrfs_fix_block_accounting btrfs-progs: check: Remove root parameter from del_pending_extents btrfs

[PATCH 05/11] btrfs-progs: check: Make update_pinned_extents take btrfs_fs_info

2018-05-28 Thread Nikolay Borisov
This function needs btrfs_fs_info and not a root. So make it directly take btrfs_fs_info, Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- extent-tree.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index 89fed5

[PATCH 01/11] btrfs-progs: check: Remove root argument from delete_extent_records

2018-05-28 Thread Nikolay Borisov
ransaction handle and in turn extent_root can be referenced from the fs_info. So do that to simplify the function's signature. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- check/main.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/check/main.

[PATCH 07/11] btrfs-progs: check: Remove unused root argument from btrfs_extent_post_op

2018-05-28 Thread Nikolay Borisov
This is no longer used by the callees of that function so remove it. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- check/main.c | 2 +- ctree.h | 3 +-- extent-tree.c | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/check/main.c b/check/main.c

[PATCH 06/11] btrfs-progs: Remove unused argument from clean_tree_block

2018-05-28 Thread Nikolay Borisov
This function actually uses only the extent_buffer arg but takes 3 arguments. Furthermore, it's current interface doesn't even mirror the kernel counterpart. Just remove the extra arguments. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- ctree.c | 12 ++-- dis

[PATCH 04/11] btrfs-progs: check: Remove root argument from finish_current_insert

2018-05-28 Thread Nikolay Borisov
Just reference it directly from trans->fs_info. Signed-off-by: Nikolay Borisov <nbori...@suse.com> --- extent-tree.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index e950ba6de3cc..89fed5b73b

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