RE: [bug report] btrfs: Add type check when reading a chunk

2018-07-19 Thread Gu, Jinxiang
> -Original Message- > From: David Sterba [mailto:dste...@suse.cz] > Sent: Thursday, July 19, 2018 6:14 PM > To: dste...@suse.cz; Gu, Jinxiang/顾 金香 ; Dan Carpenter > ; > linux-btrfs@vger.kernel.org > Subject: Re: [bug report] btrfs: Add type check when reading a chunk > > On Thu, Jul

[PATCH] btrfs: fix bug of chunk type check

2018-07-19 Thread Gu Jinxiang
chunk type BTRFS_BLOCK_GROUP_METADATA and BTRFS_BLOCK_GROUP_DATA should not be set in a non-mixed chunk at the same time. Since BTRFS_BLOCK_GROUP_METADATA is 0x4 and BTRFS_BLOCK_GROUP_DATA is 0x1, BTRFS_BLOCK_GROUP_METADATA & BTRFS_BLOCK_GROUP_DATA will be 0x0, so we should judge type is one of

Re: [PATCH 0/4] 3- and 4- copy RAID1

2018-07-19 Thread Andrei Borzenkov
18.07.2018 22:42, Goffredo Baroncelli пишет: > On 07/18/2018 09:20 AM, Duncan wrote: >> Goffredo Baroncelli posted on Wed, 18 Jul 2018 07:59:52 +0200 as >> excerpted: >> >>> On 07/17/2018 11:12 PM, Duncan wrote: Goffredo Baroncelli posted on Mon, 16 Jul 2018 20:29:46 +0200 as excerpted:

Re: Healthy amount of free space?

2018-07-19 Thread Andrei Borzenkov
18.07.2018 16:30, Austin S. Hemmelgarn пишет: > On 2018-07-18 09:07, Chris Murphy wrote: >> On Wed, Jul 18, 2018 at 6:35 AM, Austin S. Hemmelgarn >> wrote: >> >>> If you're doing a training presentation, it may be worth mentioning that >>> preallocation with fallocate() does not behave the same

Re: [PATCH v14.8 12/14] btrfs: dedupe: Add ioctl for inband deduplication

2018-07-19 Thread Qu Wenruo
On 2018年07月20日 08:47, Tsutomu Itoh wrote: > On 2018/07/12 10:25, Lu Fengqi wrote: >> From: Wang Xiaoguang >> >> Add ioctl interface for inband deduplication, which includes: >> 1) enable >> 2) disable >> 3) status >> >> And a pseudo RO compat flag, to imply that btrfs now supports inband >>

Re: [PATCH 6/7] btrfs: add helper btrfs_num_devices() to deduce num_devices

2018-07-19 Thread Anand Jain
On 07/19/2018 07:53 PM, David Sterba wrote: On Mon, Jul 16, 2018 at 10:58:11PM +0800, Anand Jain wrote: When the replace is running the fs_devices::num_devices also includes the replace device, however in some operations like device delete and balance it needs the actual num_devices without

Re: [PATCH v14.8 12/14] btrfs: dedupe: Add ioctl for inband deduplication

2018-07-19 Thread Tsutomu Itoh
On 2018/07/12 10:25, Lu Fengqi wrote: > From: Wang Xiaoguang > > Add ioctl interface for inband deduplication, which includes: > 1) enable > 2) disable > 3) status > > And a pseudo RO compat flag, to imply that btrfs now supports inband > dedup. > However we don't add any ondisk format change,

Re: [PATCH 0/4] 3- and 4- copy RAID1

2018-07-19 Thread waxhead
Hugo Mills wrote: On Wed, Jul 18, 2018 at 08:39:48AM +, Duncan wrote: Duncan posted on Wed, 18 Jul 2018 07:20:09 + as excerpted: Perhaps it's a case of coder's view (no code doing it that way, it's just a coincidental oddity conditional on equal sizes), vs. sysadmin's view (code or

the editing

2018-07-19 Thread Jeremy
How are you doing today? We have not heard from you yet. Are you still interested in our photo retouching services? We mainly do: e-commerce products photo retouching jewelry photos retouching model beauty/skin retouching wedding photo editing also photo cutting out, clipping path You may

Re: [PATCH 0/4] 3- and 4- copy RAID1

2018-07-19 Thread Austin S. Hemmelgarn
On 2018-07-19 13:29, Goffredo Baroncelli wrote: On 07/19/2018 01:43 PM, Austin S. Hemmelgarn wrote: On 2018-07-18 15:42, Goffredo Baroncelli wrote: On 07/18/2018 09:20 AM, Duncan wrote: Goffredo Baroncelli posted on Wed, 18 Jul 2018 07:59:52 +0200 as excerpted: On 07/17/2018 11:12 PM,

[PATCH] fstests: add test for fsync after renaming hard links of same file

2018-07-19 Thread fdmanana
From: Filipe Manana Test that if we have a file with 2 (or more) hard links in the same parent directory, rename of the hard links, rename one of the other hard links to the old name of the hard link we renamed before, create a new file in the same parent directory with the old name of second

[PATCH] Btrfs: fix mount failure after fsync due to hard link recreation

2018-07-19 Thread fdmanana
From: Filipe Manana If we end up with logging an inode reference item which has the same name but different index from the one we have persisted, we end up failing when replaying the log with an errno value of -EEXIST. The error comes from btrfs_add_link(), which is called from add_inode_ref(),

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

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 12:12:52PM -0400, Josef Bacik wrote: > On Thu, Jul 19, 2018 at 06:08:21PM +0200, David Sterba wrote: > > Please send cover letter for patchsets with more than 1 patch. > > Especially for a patchset with 20+ patches that does not seem to be > > doing anything trivial. > > >

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

2018-07-19 Thread Josef Bacik
On Thu, Jul 19, 2018 at 06:08:21PM +0200, David Sterba wrote: > Please send cover letter for patchsets with more than 1 patch. > Especially for a patchset with 20+ patches that does not seem to be > doing anything trivial. > > What problem does this fix, what's the overall idea behind the

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

2018-07-19 Thread David Sterba
Please send cover letter for patchsets with more than 1 patch. Especially for a patchset with 20+ patches that does not seem to be doing anything trivial. What problem does this fix, what's the overall idea behind the approach, what workload can trigger that etc. Thanks. -- To unsubscribe from

Re: [PATCH 17/22] btrfs: don't take the dio_sem in the fsync path

2018-07-19 Thread Filipe Manana
On Thu, Jul 19, 2018 at 4:54 PM, Josef Bacik wrote: > On Thu, Jul 19, 2018 at 04:21:58PM +0100, Filipe Manana wrote: >> On Thu, Jul 19, 2018 at 3:50 PM, Josef Bacik wrote: >> > Since we've changed the fsync() path to always run ordered extents >> > before doing the tree log we no longer need to

Re: [PATCH 10/22] btrfs: alloc space cache inode with GFP_NOFS

2018-07-19 Thread Josef Bacik
On Thu, Jul 19, 2018 at 05:44:53PM +0200, David Sterba wrote: > On Thu, Jul 19, 2018 at 06:35:33PM +0300, Nikolay Borisov wrote: > > > > > > On 19.07.2018 17:49, Josef Bacik wrote: > > > If we're allocating a new space cache inode it's likely going to be > > > under a transaction handle, so we

Re: [PATCH 10/22] btrfs: alloc space cache inode with GFP_NOFS

2018-07-19 Thread Josef Bacik
On Thu, Jul 19, 2018 at 06:35:33PM +0300, Nikolay Borisov wrote: > > > On 19.07.2018 17:49, Josef Bacik wrote: > > If we're allocating a new space cache inode it's likely going to be > > under a transaction handle, so we need to use GFP_NOFS to keep from > > deadlocking. Otherwise GFP_KERNEL is

Re: [PATCH 17/22] btrfs: don't take the dio_sem in the fsync path

2018-07-19 Thread Josef Bacik
On Thu, Jul 19, 2018 at 04:21:58PM +0100, Filipe Manana wrote: > On Thu, Jul 19, 2018 at 3:50 PM, Josef Bacik wrote: > > Since we've changed the fsync() path to always run ordered extents > > before doing the tree log we no longer need to take the dio_sem in the > > tree log path. This gets rid

Re: [PATCH 10/22] btrfs: alloc space cache inode with GFP_NOFS

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 06:35:33PM +0300, Nikolay Borisov wrote: > > > On 19.07.2018 17:49, Josef Bacik wrote: > > If we're allocating a new space cache inode it's likely going to be > > under a transaction handle, so we need to use GFP_NOFS to keep from > > deadlocking. Otherwise GFP_KERNEL is

Re: [PATCH 07/22] btrfs: don't leak ret from do_chunk_alloc

2018-07-19 Thread Nikolay Borisov
On 19.07.2018 17:49, Josef Bacik wrote: > If we're trying to make a data reservation and we have to allocate a > data chunk we could leak ret == 1, as do_chunk_alloc() will return 1 if > it allocated a chunk. Since the end of the function is the success path > just return 0. > >

Re: [PATCH 3/4] btrfs: Rename EXTENT_BUFFER_DUMMY to EXTENT_BUFFER_PRIVATE

2018-07-19 Thread David Sterba
On Fri, Jun 29, 2018 at 04:42:41PM +0300, Nikolay Borisov wrote: > > > On 29.06.2018 16:07, Qu Wenruo wrote: > > > > > > On 2018年06月29日 20:46, David Sterba wrote: > >> On Wed, Jun 27, 2018 at 04:38:24PM +0300, Nikolay Borisov wrote: > >>> EXTENT_BUFFER_DUMMY is an awful name for this flag.

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

2018-07-19 Thread Nikolay Borisov
On 19.07.2018 17:49, Josef Bacik wrote: > For enospc_debug having the block rsvs is super helpful to see if we've > done something wrong. > > Signed-off-by: Josef Bacik > --- > fs/btrfs/extent-tree.c | 15 +++ > 1 file changed, 15 insertions(+) > > diff --git

Re: [PATCH 10/22] btrfs: alloc space cache inode with GFP_NOFS

2018-07-19 Thread Nikolay Borisov
On 19.07.2018 17:49, Josef Bacik wrote: > If we're allocating a new space cache inode it's likely going to be > under a transaction handle, so we need to use GFP_NOFS to keep from > deadlocking. Otherwise GFP_KERNEL is fine. > > Signed-off-by: Josef Bacik > --- > fs/btrfs/free-space-cache.c

Re: [PATCH 17/22] btrfs: don't take the dio_sem in the fsync path

2018-07-19 Thread Filipe Manana
On Thu, Jul 19, 2018 at 3:50 PM, Josef Bacik wrote: > Since we've changed the fsync() path to always run ordered extents > before doing the tree log we no longer need to take the dio_sem in the > tree log path. This gets rid of a lockdep splat that I was seeing with > the AIO tests. So

Re: [PATCH 1/4] btrfs: Refactor loop in btrfs_release_extent_buffer_page

2018-07-19 Thread David Sterba
On Mon, Jul 02, 2018 at 01:03:41PM +0300, Nikolay Borisov wrote: > > > On 29.06.2018 15:35, David Sterba wrote: > > On Wed, Jun 27, 2018 at 04:38:22PM +0300, Nikolay Borisov wrote: > >> The purpose of the function is to free all the pages comprising an > >> extent buffer. This can be achieved

Re: [PATCH 17/22] btrfs: don't take the dio_sem in the fsync path

2018-07-19 Thread Filipe Manana
On Thu, Jul 19, 2018 at 3:50 PM, Josef Bacik wrote: > Since we've changed the fsync() path to always run ordered extents > before doing the tree log we no longer need to take the dio_sem in the > tree log path. This gets rid of a lockdep splat that I was seeing with > the AIO tests. The dio_sem

Re: [PATCH 1/2] btrfs: Simplify page unlocking in alloc_extent_buffer

2018-07-19 Thread David Sterba
On Wed, Jul 04, 2018 at 10:24:51AM +0300, Nikolay Borisov wrote: > Current version of the page unlocking code was added in > 727011e07cbd ("Btrfs: allow metadata blocks larger than the page size") > but even in this commit that particular flag was never used per-se. In > fact, btrfs only uses

[PATCH 02/22] btrfs: add cleanup_ref_head_accounting helper

2018-07-19 Thread Josef Bacik
From: Josef Bacik We were missing some quota cleanups in check_ref_cleanup, so break the ref head accounting cleanup into a helper and call that from both check_ref_cleanup and cleanup_ref_head. This will hopefully ensure that we don't screw up accounting in the future for other things that we

[PATCH 22/22] btrfs: only run delayed refs if we're committing

2018-07-19 Thread Josef Bacik
I noticed in a giant dbench run that we spent a lot of time on lock contention while running transaction commit. This is because dbench results in a lot of fsync()'s that do a btrfs_transaction_commit(), and they all run the delayed refs first thing, so they all contend with each other. This

[PATCH 21/22] btrfs: reset max_extent_size on clear in a bitmap

2018-07-19 Thread Josef Bacik
From: Josef Bacik We need to clear the max_extent_size when we clear bits from a bitmap since it could have been from the range that contains the max_extent_size. Signed-off-by: Josef Bacik --- fs/btrfs/free-space-cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH 01/22] btrfs: add btrfs_delete_ref_head helper

2018-07-19 Thread Josef Bacik
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. Signed-off-by: Josef Bacik --- fs/btrfs/delayed-ref.c | 14 ++ fs/btrfs/delayed-ref.h | 3 ++- fs/btrfs/extent-tree.c | 24

[PATCH 20/22] btrfs: don't use ctl->free_space for max_extent_size

2018-07-19 Thread Josef Bacik
From: Josef Bacik max_extent_size is supposed to be the largest contiguous range for the space info, and ctl->free_space is the total free space in the block group. We need to keep track of these separately and _only_ use the max_free_space if we don't have a max_extent_size, as that means our

[PATCH 15/22] btrfs: run delayed iputs before committing

2018-07-19 Thread Josef Bacik
We want to have a complete picture of any delayed inode updates before we make the decision to commit or not, so make sure we run delayed iputs before making the decision to commit or not. Signed-off-by: Josef Bacik --- fs/btrfs/extent-tree.c | 4 1 file changed, 4 insertions(+) diff

[PATCH 03/22] btrfs: use cleanup_extent_op in check_ref_cleanup

2018-07-19 Thread Josef Bacik
From: Josef Bacik Unify the extent_op handling as well, just add a flag so we don't actually run the extent op from check_ref_cleanup and instead return a value so that we can skip cleaning up the ref head. Signed-off-by: Josef Bacik --- fs/btrfs/extent-tree.c | 19 ++- 1 file

[PATCH 10/22] btrfs: alloc space cache inode with GFP_NOFS

2018-07-19 Thread Josef Bacik
If we're allocating a new space cache inode it's likely going to be under a transaction handle, so we need to use GFP_NOFS to keep from deadlocking. Otherwise GFP_KERNEL is fine. Signed-off-by: Josef Bacik --- fs/btrfs/free-space-cache.c | 5 + fs/btrfs/inode.c| 3 ++-

[PATCH 17/22] btrfs: don't take the dio_sem in the fsync path

2018-07-19 Thread Josef Bacik
Since we've changed the fsync() path to always run ordered extents before doing the tree log we no longer need to take the dio_sem in the tree log path. This gets rid of a lockdep splat that I was seeing with the AIO tests. Signed-off-by: Josef Bacik --- fs/btrfs/tree-log.c | 2 -- 1 file

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

2018-07-19 Thread Josef Bacik
For enospc_debug having the block rsvs is super helpful to see if we've done something wrong. Signed-off-by: Josef Bacik --- fs/btrfs/extent-tree.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index

[PATCH 05/22] btrfs: introduce delayed_refs_rsv

2018-07-19 Thread Josef Bacik
From: Josef Bacik Traditionally we've had voodoo in btrfs to account for the space that delayed refs may take up by having a global_block_rsv. This works most of the time, except when it doesn't. We've had issues reported and seen in production where sometimes the global reserve is exhausted

[PATCH 16/22] btrfs: loop in inode_rsv_refill

2018-07-19 Thread Josef Bacik
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 complete. So instead try to make our reservation, and if we couldn't make

[PATCH 09/22] btrfs: release metadata before running delayed refs

2018-07-19 Thread Josef Bacik
We want to release the unused reservation we have since it refills the delayed refs reserve, which will make everything go smoother when running the delayed refs if we're short on our reservation. Signed-off-by: Josef Bacik --- fs/btrfs/transaction.c | 6 +++--- 1 file changed, 3 insertions(+),

[PATCH 14/22] btrfs: don't enospc all tickets on flush failure

2018-07-19 Thread Josef Bacik
With the introduction of the per-inode block_rsv it became possible to have really really large reservation requests made because of data fragmentation. Since the ticket stuff assumed that we'd always have relatively small reservation requests it just killed all tickets if we were unable to

[PATCH 19/22] btrfs: set max_extent_size properly

2018-07-19 Thread Josef Bacik
From: Josef Bacik We can't use entry->bytes if our entry is a bitmap entry, we need to use entry->max_extent_size in that case. Fix up all the logic to make this consistent. Signed-off-by: Josef Bacik --- fs/btrfs/free-space-cache.c | 29 +++-- 1 file changed, 19

[PATCH 04/22] btrfs: only track ref_heads in delayed_ref_updates

2018-07-19 Thread Josef Bacik
From: Josef Bacik We use this number to figure out how many delayed refs to run, but __btrfs_run_delayed_refs really only checks every time we need a new delayed ref head, so we always run at least one ref head completely no matter what the number of items on it. So instead track only the ref

[PATCH 06/22] btrfs: check if free bgs for commit

2018-07-19 Thread Josef Bacik
may_commit_transaction will skip committing the transaction if we don't have enough pinned space or if we're trying to find space for a SYSTEM chunk. However if we have pending free block groups in this transaction we still want to commit as we may be able to allocate a chunk to make our

[PATCH 13/22] btrfs: reset max_extent_size properly

2018-07-19 Thread Josef Bacik
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 we add a new chunk or add new space. Signed-off-by: Josef Bacik

[PATCH 07/22] btrfs: don't leak ret from do_chunk_alloc

2018-07-19 Thread Josef Bacik
If we're trying to make a data reservation and we have to allocate a data chunk we could leak ret == 1, as do_chunk_alloc() will return 1 if it allocated a chunk. Since the end of the function is the success path just return 0. Signed-off-by: Josef Bacik --- fs/btrfs/extent-tree.c | 2 +- 1

[PATCH 12/22] btrfs: don't use global rsv for chunk allocation

2018-07-19 Thread Josef Bacik
We've done this forever because of the voodoo around knowing how much space we have. However we have better ways of doing this now, and on normal file systems we'll easily have a global reserve of 512MiB, and since metadata chunks are usually 1GiB that means we'll allocate metadata chunks more

[PATCH 18/22] btrfs: add ALLOC_CHUNK_FORCE to the flushing code

2018-07-19 Thread Josef Bacik
With my change to no longer take into account the global reserve for metadata allocation chunks we have this side-effect for mixed block group fs'es where we are no longer allocating enough chunks for the data/metadata requirements. To deal with this add a ALLOC_CHUNK_FORCE step to the flushing

[PATCH 11/22] btrfs: fix truncate throttling

2018-07-19 Thread Josef Bacik
We have a bunch of magic to make sure we're throttling delayed refs when truncating a file. Now that we have a delayed refs rsv and a mechanism for refilling that reserve simply use that instead of all of this magic. Signed-off-by: Josef Bacik --- fs/btrfs/inode.c | 78

Re: [PATCH 5/5] btrfs: Verify every chunk has corresponding block group at mount time

2018-07-19 Thread David Sterba
On Tue, Jul 17, 2018 at 09:32:27PM +0800, Qu Wenruo wrote: > On 2018年07月17日 20:33, David Sterba wrote: > > On Mon, Jul 16, 2018 at 09:57:43PM +0800, Qu Wenruo wrote: > > -EUCLEAN ? > > Either works for me. > >>> > >>> That's not just a cosmetic change, there's a semantic difference

Re: [PATCH RFC 2/2] btrfs: scrub: Cleanup the nodatasum fixup code

2018-07-19 Thread David Sterba
On Wed, Jul 11, 2018 at 01:41:22PM +0800, Qu Wenruo wrote: > Since we no longer use the old method, which use inode page cache and > could cause serious data corruption for compressed nodatasum extent, to > fixup nodatasum error during scrub/replace, remove all related code. > > Signed-off-by: Qu

Re: [PATCH v2] Btrfs: fix file data corruption after cloning a range and fsync

2018-07-19 Thread David Sterba
On Thu, Jul 12, 2018 at 01:36:43AM +0100, fdman...@kernel.org wrote: > From: Filipe Manana > > When we clone a range into a file we can end up dropping existing > extent maps (or trimming them) and replacing them with new ones if the > range to be cloned overlaps with a range in the destination

[PATCH] btrfs: remove remaing full_sync logic from btrfs_sync_file

2018-07-19 Thread David Sterba
The logic to check if the inode is already in the log can now be simplified since we always wait for the ordered extents to complete before deciding whether the inode needs to be logged. The big comment about it can go away too. CC: Filipe Manana Suggested-by: Filipe Manana [ code and changelog

Re: [PULL] uuid_mutex fixes and cleanups part2

2018-07-19 Thread David Sterba
On Wed, Jul 18, 2018 at 12:10:24PM +0800, Anand Jain wrote: > These patches we sent independently before and are in the mailing list. > They have been tested successfully using the xfstests. The cyclical > lockdep warning aren't due to these set of patches and they (2) can be > ignored as they are

Re: [PATCH] btrfs-progs: ins: Add v2 ioctl support in logical-resolve

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 02:03:38PM +0800, Qu Wenruo wrote: > >>> cmds-inspect.c| 17 +++-- > >>> ioctl.h | 10 +- > >>> libbtrfsutil/btrfs.h | 10 +- > >> > >> Not related to

Re: [PATCH] btrfs-progs: ins: Add v2 ioctl support in logical-resolve

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 02:15:50PM +0900, Misono Tomohiro wrote: > Add -i (ignore offset) option to logical-resolve command > to show how BTRFS_IOC_LOGICAL_INO_V2 ioctl works > (returns every ref to the extent of given logical address). > > [Example] > $ mkfs.btrfs -f $DEV > $ mount $DEV /mnt >

Re: [PATCH 6/7] btrfs: drop extent_io_ops::merge_bio_hook callback

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 03:02:58PM +0300, Nikolay Borisov wrote: > On 19.07.2018 14:05, David Sterba wrote: > > The data and metadata callback implementation both use the same > > function. We can remove the call indirection completely. > > > > Signed-off-by: David Sterba > > --- > >

Re: [PATCH 3/7] btrfs: do device clone using the btrfs_scan_one_device

2018-07-19 Thread David Sterba
On Mon, Jul 16, 2018 at 10:58:08PM +0800, Anand Jain wrote: > When we add a device to the RO mounted seed device, it becomes a > RW sprout FS. The following steps are used to hold the seed and > sprout fs_devices. > (first two steps are not mandatory for the sprouting, they are there > to

Re: [PATCH 0/7] Structure and callback cleanups

2018-07-19 Thread Nikolay Borisov
On 19.07.2018 14:05, David Sterba wrote: > A handful of removed structure members that are not used, > async_submit_bio is down by 16 bytes and async_cow by 8. > > Some of the extent_io_ops callbacks are unnecessarily called indirectly. > The rest of extent_io_ops is going to be transformed in

Re: [PATCH 6/7] btrfs: drop extent_io_ops::merge_bio_hook callback

2018-07-19 Thread Nikolay Borisov
On 19.07.2018 14:05, David Sterba wrote: > The data and metadata callback implementation both use the same > function. We can remove the call indirection completely. > > Signed-off-by: David Sterba > --- > fs/btrfs/compression.c | 10 +++--- > fs/btrfs/disk-io.c | 2 -- >

Re: [PATCH 4/7] btrfs: use the assigned fs_devices instead of the dereference

2018-07-19 Thread David Sterba
On Mon, Jul 16, 2018 at 10:58:09PM +0800, Anand Jain wrote: > We have assigned the %fs_info->fs_devices in %fs_devices as its not > modified just use it for the mutex_lock(). > > Signed-off-by: Anand Jain Applied, as it's independent of the rest. -- To unsubscribe from this list: send the line

Re: [PATCH 6/7] btrfs: add helper btrfs_num_devices() to deduce num_devices

2018-07-19 Thread David Sterba
On Mon, Jul 16, 2018 at 10:58:11PM +0800, Anand Jain wrote: > When the replace is running the fs_devices::num_devices also includes > the replace device, however in some operations like device delete and > balance it needs the actual num_devices without the repalce devices, so > now the function

Re: [PATCH 0/4] 3- and 4- copy RAID1

2018-07-19 Thread Austin S. Hemmelgarn
On 2018-07-19 03:27, Qu Wenruo wrote: On 2018年07月14日 02:46, David Sterba wrote: Hi, I have some goodies that go into the RAID56 problem, although not implementing all the remaining features, it can be useful independently. This time my hackweek project

Re: [PATCH 7/7] btrfs: add helper function check device delete able

2018-07-19 Thread David Sterba
On Mon, Jul 16, 2018 at 10:58:12PM +0800, Anand Jain wrote: > Move the section of the code which performs the check if the device is > indelible, move that into a helper function. > > Signed-off-by: Anand Jain > --- > v1->v2: Rename function to btrfs_get_device_for_delete(), thanks > Nikolay. >

Re: [PATCH 0/4] 3- and 4- copy RAID1

2018-07-19 Thread Austin S. Hemmelgarn
On 2018-07-18 15:42, Goffredo Baroncelli wrote: On 07/18/2018 09:20 AM, Duncan wrote: Goffredo Baroncelli posted on Wed, 18 Jul 2018 07:59:52 +0200 as excerpted: On 07/17/2018 11:12 PM, Duncan wrote: Goffredo Baroncelli posted on Mon, 16 Jul 2018 20:29:46 +0200 as excerpted: On 07/15/2018

Re: Healthy amount of free space?

2018-07-19 Thread Austin S. Hemmelgarn
On 2018-07-18 17:32, Chris Murphy wrote: On Wed, Jul 18, 2018 at 12:01 PM, Austin S. Hemmelgarn wrote: On 2018-07-18 13:40, Chris Murphy wrote: On Wed, Jul 18, 2018 at 11:14 AM, Chris Murphy wrote: I don't know for sure, but based on the addresses reported before and after dd for the

[PATCH 7/7] btrfs: drop extent_io_ops::set_range_writeback callback

2018-07-19 Thread David Sterba
The data and metadata callback implementation both use the same function. We can remove the call indirection and intermediate helper completely. Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 2 +- fs/btrfs/disk-io.c | 1 - fs/btrfs/extent_io.c | 10 +- fs/btrfs/extent_io.h

[PATCH 6/7] btrfs: drop extent_io_ops::merge_bio_hook callback

2018-07-19 Thread David Sterba
The data and metadata callback implementation both use the same function. We can remove the call indirection completely. Signed-off-by: David Sterba --- fs/btrfs/compression.c | 10 +++--- fs/btrfs/disk-io.c | 2 -- fs/btrfs/extent_io.c | 4 ++-- fs/btrfs/extent_io.h | 3 ---

[PATCH 3/7] btrfs: remove redundant member async_cow::root

2018-07-19 Thread David Sterba
The root is only used to get fs_info out of it, but the same can be retrieved from the inode that's in async_cow. Signed-off-by: David Sterba --- fs/btrfs/inode.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index

[PATCH 4/7] btrfs: unify end_io callbacks of async_submit_bio

2018-07-19 Thread David Sterba
The end_io callbacks passed to btrfs_wq_submit_bio (btrfs_submit_bio_done and btree_submit_bio_done) are effectively the same code, there's no point to do the indirection. Export btrfs_submit_bio_done and call it directly. Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 28

[PATCH 1/7] btrfs: remove unused member async_submit_bio::fs_info

2018-07-19 Thread David Sterba
Introduced by c6100a4b4e3d1 ("Btrfs: replace tree->mapping with tree->private_data") to be used in run_one_async_done where it got unused after 736cd52e0c720103 ("Btrfs: remove nr_async_submits and async_submit_draining"). Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 2 -- 1 file

[PATCH 2/7] btrfs: remove unused member async_submit_bio::bio_flags

2018-07-19 Thread David Sterba
After splitting the start and end hooks in a758781d4b76c3 ("btrfs: separate types for submit_bio_start and submit_bio_done"), some of the function arguments were dropped but not removed from the structure. Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 2 -- 1 file changed, 2 deletions(-)

[PATCH 0/7] Structure and callback cleanups

2018-07-19 Thread David Sterba
A handful of removed structure members that are not used, async_submit_bio is down by 16 bytes and async_cow by 8. Some of the extent_io_ops callbacks are unnecessarily called indirectly. The rest of extent_io_ops is going to be transformed in following series. David Sterba (7): btrfs: remove

[PATCH 5/7] btrfs: drop extent_io_ops::tree_fs_info callback

2018-07-19 Thread David Sterba
All implementations of the callback are trivial and do the same and there's only user. Merge everything together. Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 7 --- fs/btrfs/extent_io.c | 14 -- fs/btrfs/extent_io.h | 1 - fs/btrfs/inode.c | 7 --- 4 files

Re: [bug report] btrfs: Add type check when reading a chunk

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 11:22:01AM +0200, David Sterba wrote: > On Thu, Jul 19, 2018 at 08:18:25AM +, Gu, Jinxiang wrote: > > > > > > > -Original Message- > > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > > > Sent: Thursday, July 19, 2018 4:11 PM > > > To: Gu, Jinxiang/顾

Re: [PATCH] btrfs: tree-checker: Add DATA_RELOC tree to essential non-empty tree list

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 03:05:14PM +0800, Qu Wenruo wrote: > DATA RELOC tree should also never be empty. > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=200407 > Reported-by: Xu Wen > Signed-off-by: Qu Wenruo > --- > It's possible just fold this fix into commit "btrfs: tree-checker:

Re: btrfs check (not lowmem) and OOM-like hangs (4.17.6)

2018-07-19 Thread Qu Wenruo
On 2018年07月18日 08:24, Marc MERLIN wrote: > On Wed, Jul 18, 2018 at 08:05:51AM +0800, Qu Wenruo wrote: >> No OOM triggers? That's a little strange. >> Maybe it's related to how kernel handles memory over-commit? > > Yes, I think you are correct. > >> And for the hang, I think it's related to

Re: [bug report] btrfs: Add type check when reading a chunk

2018-07-19 Thread David Sterba
On Thu, Jul 19, 2018 at 08:18:25AM +, Gu, Jinxiang wrote: > > > > -Original Message- > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > > Sent: Thursday, July 19, 2018 4:11 PM > > To: Gu, Jinxiang/顾 金香 > > Cc: linux-btrfs@vger.kernel.org > > Subject: [bug report] btrfs: Add

RE: [bug report] btrfs: Add type check when reading a chunk

2018-07-19 Thread Gu, Jinxiang
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Thursday, July 19, 2018 4:11 PM > To: Gu, Jinxiang/顾 金香 > Cc: linux-btrfs@vger.kernel.org > Subject: [bug report] btrfs: Add type check when reading a chunk > > Hello Gu Jinxiang, > > The patch

[bug report] btrfs: Add type check when reading a chunk

2018-07-19 Thread Dan Carpenter
Hello Gu Jinxiang, The patch 72e75ed03c8d: "btrfs: Add type check when reading a chunk" from Jul 4, 2018, leads to the following static checker warning: fs/btrfs/volumes.c:6388 btrfs_check_chunk_valid() warn: AND to zero '0x4 & 0x1' fs/btrfs/volumes.c 6356 if

[bug report] btrfs: add helper function check device delete able

2018-07-19 Thread Dan Carpenter
Hello Anand Jain, The patch a6500c9ef8ac: "btrfs: add helper function check device delete able" from Jul 10, 2018, leads to the following static checker warning: fs/btrfs/volumes.c:1871 btrfs_device_delete_able() error: passing non negative 4 to ERR_PTR

Re: [PATCH] btrfs: tree-checker: Add DATA_RELOC tree to essential non-empty tree list

2018-07-19 Thread Su Yue
On 07/19/2018 03:05 PM, Qu Wenruo wrote: DATA RELOC tree should also never be empty. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200407 Reported-by: Xu Wen Signed-off-by: Qu Wenruo Reviewed-by: Su Yue --- It's possible just fold this fix into commit "btrfs: tree-checker: Detect

Re: [PATCH 0/4] 3- and 4- copy RAID1

2018-07-19 Thread Qu Wenruo
On 2018年07月14日 02:46, David Sterba wrote: > Hi, > > I have some goodies that go into the RAID56 problem, although not > implementing all the remaining features, it can be useful independently. > > This time my hackweek project > >

[PATCH] btrfs: tree-checker: Add DATA_RELOC tree to essential non-empty tree list

2018-07-19 Thread Qu Wenruo
DATA RELOC tree should also never be empty. Link: https://bugzilla.kernel.org/show_bug.cgi?id=200407 Reported-by: Xu Wen Signed-off-by: Qu Wenruo --- It's possible just fold this fix into commit "btrfs: tree-checker: Detect invalid empty essential tree". And for the test image, it can already

Re: [PATCH] btrfs-progs: ins: Add v2 ioctl support in logical-resolve

2018-07-19 Thread Qu Wenruo
On 2018年07月19日 13:59, Lu Fengqi wrote: > On Thu, Jul 19, 2018 at 01:51:59PM +0800, Qu Wenruo wrote: >> >> >> On 2018年07月19日 13:15, Misono Tomohiro wrote: >>> Add -i (ignore offset) option to logical-resolve command >>> to show how BTRFS_IOC_LOGICAL_INO_V2 ioctl works >>> (returns every ref to