[PATCH v2] Btrfs: add write_flags for compression bio

2017-10-24 Thread Liu Bo
to be differentiated from each other, because from the POV of block layer, all bios need to be recognized by these flags in order to do some management, e.g. throttlling. This passes writeback_control to compression write path so that it can send bios with proper flags to block layer. Signed-off-by: Liu

[PATCH v3] Btrfs: free btrfs_device in place

2017-10-24 Thread Liu Bo
It's pointless to defer it to a kthread helper as we're not under a special context. For reference, commit 1f78160ce1b1 ("Btrfs: using rcu lock in the reader side of devices list") introduced RCU freeing for device structures. Signed-off-by: Liu Bo <bo.li@oracle.com> Reviewe

[PATCH] fstests: btrfs/143: make test case more reliable

2017-10-23 Thread Liu Bo
'fadvise -d' to firstly access all metadata it needs to locate the file and then only drops the test file's page cache. Also this changes it to read the file only if pid%2 == 1. Reported-by: Nikolay Borisov <nbori...@suse.com> Signed-off-by: Liu Bo <bo.li@oracle.com> --- tests/bt

Re: [PATCH] Btrfs: avoid deadlock in btrfs_async_run_delayed_root

2017-10-20 Thread Liu Bo
Hi, Please ignore this patch, I misunderstood the lock order. thanks, -liubo On Fri, Oct 20, 2017 at 05:40:12PM -0600, Liu Bo wrote: > Here %path is set with ->leave_spinning=1, thus it'll hold the rwlock > after btrfs_search_slot(), however, when processing dela

[PATCH] Btrfs: remove redundant btrfs_balance_delayed_items

2017-10-20 Thread Liu Bo
In functions like btrfs_create(), we run both btrfs_balance_delayed_items() and btrfs_btree_balance_dirty() after the operation, but btrfs_btree_balance_dirty() is surely going to run btrfs_balance_delayed_items(). This keeps only btrfs_btree_balance_dirty(). Signed-off-by: Liu Bo <bo

[PATCH] Btrfs: avoid deadlock in btrfs_async_run_delayed_root

2017-10-20 Thread Liu Bo
necessary to avoid race between async works, this remove the ->leave_spining setting. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/delayed-inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 19e4ad2..a857a2f 100

Re: [PATCH v2] Fstest: btrfs/151: test if device delete ends up with losing raid profile

2017-10-16 Thread Liu Bo
On Sat, Oct 14, 2017 at 01:33:17PM +0800, Eryu Guan wrote: > On Fri, Oct 13, 2017 at 01:40:05PM -0600, Liu Bo wrote: > > Currently running 'btrfs device delete' can end up with losing data > > raid profile (if any), this test is to reproduce the problem. > > > > The fi

[PATCH v2 RESEND] Fstest: btrfs/151: test if device delete ends up with losing raid profile

2017-10-16 Thread Liu Bo
Currently running 'btrfs device delete' can end up with losing data raid profile (if any), this test is to reproduce the problem. The fix is "Btrfs: avoid losing data raid profile when deleting a device" Signed-off-by: Liu Bo <bo.li@oracle.com>

Re: [PATCH] Fstest: btrfs/151: test if device delete ends up with losing raid profile

2017-10-16 Thread Liu Bo
On Mon, Oct 16, 2017 at 09:57:11AM +0300, Nikolay Borisov wrote: > > > On 13.10.2017 21:08, Liu Bo wrote: > > On Thu, Oct 12, 2017 at 03:06:57PM +0800, Eryu Guan wrote: > >> On Mon, Oct 09, 2017 at 11:39:21AM -0600, Liu Bo wrote: > >>> Currently runn

Re: [PATCH] Btrfs: add write_flags for compression bio

2017-10-16 Thread Liu Bo
On Mon, Oct 16, 2017 at 03:33:10PM +0200, David Sterba wrote: > On Fri, Oct 13, 2017 at 03:10:35PM -0600, Liu Bo wrote: > > Compression code path has only flaged bios with REQ_OP_WRITE no matter > > where the bios come from. This breaks the rule that sync writes and > >

Re: [PATCH v2] Btrfs: avoid losing data raid profile when deleting a device

2017-10-16 Thread Liu Bo
On Mon, Oct 16, 2017 at 12:22:44PM +0800, Anand Jain wrote: > > > On 10/14/2017 04:51 AM, Liu Bo wrote: > >On Wed, Oct 11, 2017 at 10:38:50AM +0300, Nikolay Borisov wrote: > >> > >> > >>On 10.10.2017 20:53, Liu Bo wrote: > >>>We'

[PATCH] Btrfs: add write_flags for compression bio

2017-10-13 Thread Liu Bo
flags to block layer. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/compression.c | 7 --- fs/btrfs/compression.h | 3 ++- fs/btrfs/extent_io.c | 2 +- fs/btrfs/extent_io.h | 3 ++- fs/btrfs/inode.c | 15 +++ 5 files changed, 20 insertions(+), 10 del

Re: [PATCH v2] Btrfs: avoid losing data raid profile when deleting a device

2017-10-13 Thread Liu Bo
On Wed, Oct 11, 2017 at 10:38:50AM +0300, Nikolay Borisov wrote: > > > On 10.10.2017 20:53, Liu Bo wrote: > > We've avoided data losing raid profile when doing balance, but it > > turns out that deleting a device could also result in the same > > problem >

[PATCH v2] Fstest: btrfs/151: test if device delete ends up with losing raid profile

2017-10-13 Thread Liu Bo
Currently running 'btrfs device delete' can end up with losing data raid profile (if any), this test is to reproduce the problem. The fix is "Btrfs: avoid losing data raid profile when deleting a device" Signed-off-by: Liu Bo <bo.li@oracle.com> --- tests/bt

Re: [PATCH v8 1/2] btrfs: introduce device dynamic state transition to failed

2017-10-13 Thread Liu Bo
On Tue, Oct 03, 2017 at 11:59:19PM +0800, Anand Jain wrote: > From: Anand Jain > > This patch provides helper functions to force a device to failed, > and we need it for the following reasons, > 1) a. It can be reported that device has failed when it does and >b. Close

Re: [PATCH v8 2/2] btrfs: check device for critical errors and mark failed

2017-10-13 Thread Liu Bo
On Sun, Oct 08, 2017 at 10:23:58PM +0800, Anand Jain wrote: > > > On 10/07/2017 07:56 AM, Liu Bo wrote: > > On Thu, Oct 05, 2017 at 09:56:59PM +0800, Anand Jain wrote: > > > > > > > > > On 10/05/2017 04:11 AM, Liu Bo wrote: > > > > On T

Re: [PATCH] Fstest: btrfs/151: test if device delete ends up with losing raid profile

2017-10-13 Thread Liu Bo
On Thu, Oct 12, 2017 at 03:06:57PM +0800, Eryu Guan wrote: > On Mon, Oct 09, 2017 at 11:39:21AM -0600, Liu Bo wrote: > > Currently running 'btrfs device delete' can end up with losing data raid > > profile (if any), this test is to reproduce the problem. > > > > The fi

Re: [PATCH] btrfs: fix false EIO for missing device

2017-10-13 Thread Liu Bo
9; > - bio->bi_status = BLK_STS_IOERR; > + if (atomic_read(>error) > bbio->max_errors) > + bio->bi_status = BLK_STS_IOERR; > + else > + bio->bi_status = 0; Thanks for the fix, I'd prefer BLK_STS_O

[PATCH v2] Btrfs: free btrfs_device in place

2017-10-11 Thread Liu Bo
ess the device immediately after we do umount. Signed-off-by: Liu Bo <bo.li@oracle.com> Reviewed-by: Anand Jain <anand.j...@oracle.com> --- v2: Clarify the lifetime of device and device->bdev respectively and clear the concern about raising the 'device is in use' problem. fs/bt

[PATCH v2] Btrfs-progs: do not add stale device into fs_devices

2017-10-11 Thread Liu Bo
users as people may monitor btrfs by running that cli. This does the similar thing to what kernel side has done. Signed-off-by: Liu Bo <bo.li@oracle.com> Reviewed-by: Anand Jain <anand.j...@oracle.com> --- v2: remove a wrong parameter. volumes.c | 15 ++- 1 file

Re: [PATCH] Btrfs: free btrfs_device in place

2017-10-11 Thread Liu Bo
On Wed, Oct 11, 2017 at 07:54:04PM +0200, David Sterba wrote: > On Tue, Oct 10, 2017 at 03:51:03PM -0600, Liu Bo wrote: > > It's pointless to defer it to a kthread helper as we're not under any > > special context. > > I agree the doubly deferred freeing is pointless. It's

Re: [PATCH] Btrfs: remove rcu_barrier in btrfs_close_devices

2017-10-11 Thread Liu Bo
On Wed, Oct 11, 2017 at 03:41:23PM +0800, Anand Jain wrote: > > > On 10/11/2017 02:11 PM, Anand Jain wrote: > > > > > > On 10/11/2017 05:51 AM, Liu Bo wrote: > > > It was introduced because btrfs used to do blkdev_put in a deferred > > >

Re: [PATCH] Btrfs-progs: do not add stale device into fs_devices

2017-10-11 Thread Liu Bo
On Wed, Oct 11, 2017 at 12:33:15PM +0300, Nikolay Borisov wrote: > > > On 11.10.2017 03:28, Liu Bo wrote: > > If one of btrfs's devices was pulled out and we've replaced it with a > > new one, then they have the same uuid. > > > > If that device gets re

Re: [PATCH 3/3] Btrfs: remove nr_async_submits and async_submit_draining

2017-10-11 Thread Liu Bo
On Wed, Oct 11, 2017 at 07:20:32PM +0200, David Sterba wrote: > On Wed, Sep 27, 2017 at 02:31:17PM +0200, David Sterba wrote: > > On Thu, Sep 07, 2017 at 11:22:22AM -0600, Liu Bo wrote: > > > Now that we have the combo of flushing twice, which can make sure IO > > > ha

[PATCH] Btrfs-progs: do not add stale device into fs_devices

2017-10-10 Thread Liu Bo
users as people may monitor btrfs by running that cli. This does the similar thing to what kernel side has done. Signed-off-by: Liu Bo <bo.li@oracle.com> --- volumes.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/volumes.c b/volumes.c index 2

Re: [PATCH v2 1/4] btrfs: add_missing_dev() should return the actual error

2017-10-10 Thread Liu Bo
o *fs_info, > } > > device = add_missing_dev(fs_devices, devid, dev_uuid); > - if (!device) > - return -ENOMEM; > + if (IS_ERR(device)) > + return PTR_ERR(device); Could you

[PATCH] Btrfs: remove rcu_barrier in btrfs_close_devices

2017-10-10 Thread Liu Bo
It was introduced because btrfs used to do blkdev_put in a deferred work, now that btrfs has put blkdev in place, this rcu_barrier can be removed. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/volumes.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/volumes.

[PATCH] Btrfs: free btrfs_device in place

2017-10-10 Thread Liu Bo
It's pointless to defer it to a kthread helper as we're not under any special context. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/volumes.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d

[PATCH v2] Btrfs: avoid losing data raid profile when deleting a device

2017-10-10 Thread Liu Bo
the time so their raid profile is persistent. Reported-by: James Alandt <james.ala...@wdc.com> Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: - return the correct error. - move helper ahead of __btrfs_balance(). fs/btrfs/volumes.c | 84 ++---

Re: [PATCH v2 5/5] btrfs: ensure that metadata and flush are issued from the root cgroup

2017-10-10 Thread Liu Bo
isn't desirable, > please feel free to drop the section. > > v2: Fixed missing @bh in submit_bh_blkcg_css() call. > Looks good. Reviewed-by: Liu Bo <bo.li@oracle.com> -liubo > Signed-off-by: Tejun Heo <t...@kernel.org> > Cc: Chris Mason <c...@fb.com> >

Re: [PATCH] Btrfs: avoid losing data raid profile when deleting a device

2017-10-10 Thread Liu Bo
On Tue, Oct 10, 2017 at 09:57:46AM +0300, Nikolay Borisov wrote: > > > On 9.10.2017 21:01, Liu Bo wrote: > > We've avoided data losing raid profile when doing balance, but it > > turns out that deleting a device could also result in the same > > problem. >

[PATCH] Btrfs: avoid losing data raid profile when deleting a device

2017-10-09 Thread Liu Bo
the time so their raid profile is persistent. Reported-by: James Alandt <james.ala...@wdc.com> Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/volumes.c | 87 ++ 1 file changed, 68 insertions(+), 19 deletions(-) diff --gi

[PATCH] Fstest: btrfs/151: test if device delete ends up with losing raid profile

2017-10-09 Thread Liu Bo
Currently running 'btrfs device delete' can end up with losing data raid profile (if any), this test is to reproduce the problem. The fix is "Btrfs: avoid losing data raid profile when deleting a device" Signed-off-by: Liu Bo <bo.li@oracle.com> --- tests/bt

Re: [PATCH 3/3] btrfs: get rid of sector_t and use u64 offset in submit_extent_page

2017-10-06 Thread Liu Bo
t_writepage, >0, 0, 0, false); > @@ -3748,7 +3749,7 @@ static noinline_for_stack int write_one_eb(struct > extent_buffer *eb, > clear_page_dirty_for_io(p); > set_page_writeback(p); > ret = submit_extent_page(REQ_OP_WRITE | write_flags, tree

Re: [PATCH 1/3] btrfs: scrub: get rid of sector_t

2017-10-06 Thread Liu Bo
rcu_str_deref(dev->name), > - (unsigned long long)swarn.sector, > + swarn.physical, > ref_level ? "node" : "leaf", >

Re: [PATCH 2/3] btrfs: rename page offset parameter in submit_extent_page

2017-10-06 Thread Liu Bo
, page, page_size, offset); > + bio_add_page(bio, page, page_size, pg_offset); > bio->bi_end_io = end_io_func; > bio->bi_private = tree; > bio->bi_write_hint = page->mapping->host->i_write_hint; Reviewed-by: Liu Bo <bo.li@oracle.com> -

Re: "BTRFS error (device vda1): couldn't get super buffer head for bytenr x"

2017-10-06 Thread Liu Bo
On Fri, Oct 06, 2017 at 12:25:17PM +0200, Nick Gilmour wrote: > Hi all, > > I have converted .vdi disk (BTRFS) into a .img disk, resized it from > 500GB to 150GB and then copied into a ZFS Volume. I've imported the VM > into VMM and it started normally but an upgrade failed. I've rebooted > and

Re: [PATCH v8 2/2] btrfs: check device for critical errors and mark failed

2017-10-06 Thread Liu Bo
On Thu, Oct 05, 2017 at 09:56:59PM +0800, Anand Jain wrote: > > > On 10/05/2017 04:11 AM, Liu Bo wrote: > > On Tue, Oct 03, 2017 at 11:59:20PM +0800, Anand Jain wrote: > > > From: Anand Jain <anand.j...@oracle.com> > > > > > > Write and flush erro

Re: [PATCH v8 2/2] btrfs: check device for critical errors and mark failed

2017-10-06 Thread Liu Bo
On Thu, Oct 05, 2017 at 07:07:44AM -0400, Austin S. Hemmelgarn wrote: > On 2017-10-04 16:11, Liu Bo wrote: > > On Tue, Oct 03, 2017 at 11:59:20PM +0800, Anand Jain wrote: > > > From: Anand Jain <anand.j...@oracle.com> > > > > > > Write and flush errors

Re: [GIT PULL] Btrfs fixes for 4.14-rc4

2017-10-06 Thread Liu Bo
On Fri, Oct 06, 2017 at 11:25:12PM +0100, Tomasz Kłoczko wrote: > On rc3 is possible to observe warning about possible circular locking > dependency which I've reported on btrfs list few days ago: > Thanks for the report, neither this nor the one you reported on rc2 looks like a deadlock to me.

Re: [PATCH] btrfs: avoid overflow when sector_t is 32 bit

2017-10-05 Thread Liu Bo
On Wed, Oct 04, 2017 at 08:23:05PM +0200, David Sterba wrote: > On Wed, Oct 04, 2017 at 11:13:51AM -0600, Liu Bo wrote: > > On Wed, Oct 04, 2017 at 04:22:28PM +0200, David Sterba wrote: > > > On Tue, Oct 03, 2017 at 07:31:10PM +0200, Goffredo Baroncelli wrote: > > >

Re: [PATCH v8 2/2] btrfs: check device for critical errors and mark failed

2017-10-04 Thread Liu Bo
On Tue, Oct 03, 2017 at 11:59:20PM +0800, Anand Jain wrote: > From: Anand Jain > > Write and flush errors are critical errors, upon which the device fd > must be closed and marked as failed. > Can we defer the job of closing device to umount? We can go mark the device

Re: [PATCH] btrfs: avoid overflow when sector_t is 32 bit

2017-10-04 Thread Liu Bo
On Wed, Oct 04, 2017 at 04:22:28PM +0200, David Sterba wrote: > On Tue, Oct 03, 2017 at 07:31:10PM +0200, Goffredo Baroncelli wrote: > > From: Goffredo Baroncelli > > > > Jean-Denis Girard noticed commit c821e7f3 "pass bytes to > > btrfs_bio_alloc"

Re: [PATCH 1/3] Btrfs: remove nr_async_bios

2017-09-29 Thread Liu Bo
On Wed, Sep 27, 2017 at 01:30:13PM +0200, David Sterba wrote: > On Thu, Sep 07, 2017 at 11:22:20AM -0600, Liu Bo wrote: > > This was intended to congest higher layers to not send bios, but as > > > > 1) the congested bit has been taken by writeback > > Can you p

[PATCH v3] fstests: btrfs/150 regression test for reading compressed data

2017-09-27 Thread Liu Bo
We had a bug in btrfs compression code which could end up with a kernel panic. This is adding a regression test for the bug and I've also sent a kernel patch to fix the bug. The patch is "Btrfs: fix kernel oops while reading compressed data". Signed-off-by: Liu Bo <bo.li@oracl

Re: [PATCH v2] fstests: btrfs/150 regression test for reading compressed data

2017-09-27 Thread Liu Bo
On Wed, Sep 27, 2017 at 05:46:44PM +0800, Eryu Guan wrote: > On Tue, Sep 26, 2017 at 05:18:51PM -0700, Liu Bo wrote: > > On Tue, Sep 26, 2017 at 04:37:52PM -0700, Liu Bo wrote: > > > On Tue, Sep 26, 2017 at 05:02:36PM +0800, Eryu Guan wrote: > > > > On Fri, Sep 22, 20

Re: [PATCH v2] fstests: btrfs/150 regression test for reading compressed data

2017-09-26 Thread Liu Bo
On Tue, Sep 26, 2017 at 04:37:52PM -0700, Liu Bo wrote: > On Tue, Sep 26, 2017 at 05:02:36PM +0800, Eryu Guan wrote: > > On Fri, Sep 22, 2017 at 05:21:27PM -0600, Liu Bo wrote: > > > We had a bug in btrfs compression code which could end up with a > > > kernel panic.

Re: [PATCH v2] fstests: btrfs/150 regression test for reading compressed data

2017-09-26 Thread Liu Bo
On Tue, Sep 26, 2017 at 05:02:36PM +0800, Eryu Guan wrote: > On Fri, Sep 22, 2017 at 05:21:27PM -0600, Liu Bo wrote: > > We had a bug in btrfs compression code which could end up with a > > kernel panic. > > > > This is adding a regression test for the bug and I've a

Re: dmesg: csum "varying number" expected csum 0x0 mirror 1 (with trace/oops)

2017-09-26 Thread Liu Bo
On Wed, Sep 27, 2017 at 12:21:55AM +0200, Kai Krakow wrote: > Hello! > > I came across noting some kernel messages which seem to be related to > btrfs, should I worry? > > I'm currently running scrub on the device now. > > inode-resolve points to an unimportant, easily recoverable file: > > $

Re: [PATCH] Btrfs: use btrfs_op instead of bio_op in __btrfs_map_block

2017-09-22 Thread Liu Bo
On Sat, Sep 23, 2017 at 09:49:38AM +0900, Satoru Takeuchi wrote: > At Tue, 19 Sep 2017 17:50:09 -0600, > Liu Bo wrote: > > > > This seems to be a leftover of commit cf8cddd38bab ("btrfs: don't > > abuse REQ_OP_* flags for btrfs_map_block"). > > > >

[PATCH] Btrfs: use self-explaining variable

2017-09-22 Thread Liu Bo
This uses a bool 'do_backup' to help understand this piece of code. Signed-off-by: Liu Bo <bo.li@oracle.com> --- This is based on a patch "Btrfs: do not backup tree roots when fsync". fs/btrfs/disk-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs

[PATCH v2] fstests: btrfs/150 regression test for reading compressed data

2017-09-22 Thread Liu Bo
We had a bug in btrfs compression code which could end up with a kernel panic. This is adding a regression test for the bug and I've also sent a kernel patch to fix the bug. The patch is "Btrfs: fix kernel oops while reading compressed data". Signed-off-by: Liu Bo <bo.li@oracl

Re: [PATCH] fstests: btrfs/150 regression test for reading compressed data

2017-09-22 Thread Liu Bo
On Thu, Sep 21, 2017 at 02:39:52PM +1000, Dave Chinner wrote: > On Wed, Sep 20, 2017 at 05:52:43PM -0600, Liu Bo wrote: > > We had a bug in btrfs compression code which could end up with a > > kernel panic. > > > > This is adding a regression test for the bug and I've a

Re: [PATCH] fstests: btrfs/150 regression test for reading compressed data

2017-09-22 Thread Liu Bo
On Thu, Sep 21, 2017 at 03:03:45PM +0800, Lu Fengqi wrote: > On Wed, Sep 20, 2017 at 05:52:43PM -0600, Liu Bo wrote: > >We had a bug in btrfs compression code which could end up with a > >kernel panic. > > > >This is adding a regression test for the bug and I've also se

[PATCH] Btrfs: fix memory leak in raid56

2017-09-22 Thread Liu Bo
The local bio_list may have pending bios when doing cleanup, it can end up with memory leak if they don't get free'd. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/raid56.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/raid

Re: using fio to test btrfs compression

2017-09-21 Thread Liu Bo
On Mon, Sep 18, 2017 at 01:06:45PM +0530, shally verma wrote: > Hi > > I wanted to test btrfs compression using fio command but somehow > during fio writes, I don't see code taking route of compression blocks > where as If I do a copy to btrfs compression enabled mount point then > I can easily

[PATCH] fstests: btrfs/150 regression test for reading compressed data

2017-09-20 Thread Liu Bo
We had a bug in btrfs compression code which could end up with a kernel panic. This is adding a regression test for the bug and I've also sent a kernel patch to fix the bug. The patch is "Btrfs: fix kernel oops while reading compressed data". Signed-off-by: Liu Bo <bo.li..

[PATCH 2/2] Btrfs: skip checksum when reading compressed data if some IO have failed

2017-09-20 Thread Liu Bo
that in order to return error quickly to the upper layer. Please note that we need to do this after recording the failed mirror index so that read-repair in the upper layer's endio can work properly. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/compression.c | 9 - 1 file chan

[PATCH 1/2] Btrfs: fix kernel oops while reading compressed data

2017-09-20 Thread Liu Bo
bio. With this, btrfs's read-repair can work properly on reading compressed data. Signed-off-by: Liu Bo <bo.li@oracle.com> Reported-by: Paul Jones <p...@pauljones.id.au> --- fs/btrfs/compression.c | 9 + 1 file changed, 9 insertions(+) diff --git a/fs/btrfs/compressi

Re: kernel BUG at fs/btrfs/extent_io.c:1989

2017-09-20 Thread Liu Bo
On Wed, Sep 20, 2017 at 02:53:57PM +0200, David Sterba wrote: > On Tue, Sep 19, 2017 at 10:12:39AM -0600, Liu Bo wrote: > > On Tue, Sep 19, 2017 at 05:07:25PM +0200, David Sterba wrote: > > > On Tue, Sep 19, 2017 at 11:32:46AM +, Paul Jones wrote: > > > >

[PATCH] Btrfs: use btrfs_op instead of bio_op in __btrfs_map_block

2017-09-19 Thread Liu Bo
This seems to be a leftover of commit cf8cddd38bab ("btrfs: don't abuse REQ_OP_* flags for btrfs_map_block"). It should use btrfs_op() helper to provide one of 'enum btrfs_map_op' types. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/volumes.c | 2 +- 1 file chan

Re: kernel BUG at fs/btrfs/extent_io.c:1989

2017-09-19 Thread Liu Bo
On Tue, Sep 19, 2017 at 05:07:25PM +0200, David Sterba wrote: > On Tue, Sep 19, 2017 at 11:32:46AM +, Paul Jones wrote: > > > This 'mirror 0' looks fishy, (as mirror comes from > > > btrfs_io_bio->mirror_num, > > > which should be at least 1 if raid1 setup is in use.) > > > > > > Not sure if

Re: kernel BUG at fs/btrfs/extent_io.c:1989

2017-09-18 Thread Liu Bo
On Mon, Sep 18, 2017 at 08:55:29AM +, Paul Jones wrote: > Hi > I have a system that crashed during a defrag, upon reboot I got the > following trace while resuming the defrag. > Filesystem is BTRFS Raid1 on lvm+cache, kernel 4.13.2 > Check --repair gives lots of warnings about parent transid

Re: [PATCH] Btrfs: fix unexpected result when dio reading corrupted blocks

2017-09-18 Thread Liu Bo
On Sat, Sep 16, 2017 at 01:58:34PM +0200, Goffredo Baroncelli wrote: > On 09/15/2017 11:06 PM, Liu Bo wrote: > > commit 4246a0b63bd8 ("block: add a bi_error field to struct bio") > > changed the logic of how dio read endio reports errors. > > > > For si

Re: [PATCH] Btrfs: fix unexpected result when dio reading corrupted blocks

2017-09-18 Thread Liu Bo
On Mon, Sep 18, 2017 at 03:49:34PM +0200, Holger Hoffstätte wrote: > > Hello, quick question for backporting.. > > On 09/15/17 23:06, Liu Bo wrote: > > commit 4246a0b63bd8 ("block: add a bi_error field to struct bio") > > changed the logic of how dio read endio

Re: [PATCH] Btrfs: do not backup tree roots when fsync

2017-09-15 Thread Liu Bo
On Thu, Sep 14, 2017 at 02:49:03PM +0200, David Sterba wrote: > On Thu, Sep 14, 2017 at 09:55:48AM +0800, Qu Wenruo wrote: > > > > > > On 2017年09月14日 02:25, Liu Bo wrote: > > > It doens't make sense to backup tree roots when doing fsync, since > > > duri

[PATCH] Btrfs: fix unexpected result when dio reading corrupted blocks

2017-09-15 Thread Liu Bo
e need to report its checksum mismatch error to the upper layer (dio layer in this case) as well. Signed-off-by: Liu Bo <bo.li@oracle.com> Reported-by: Goffredo Baroncelli <kreij...@inwind.it> cc: Goffredo Baroncelli <kreij...@inwind.it> --- fs/btrfs/inode.c | 7 ++-

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Liu Bo
On Fri, Sep 15, 2017 at 08:57:41PM +0200, Goffredo Baroncelli wrote: > On 09/15/2017 07:01 PM, Liu Bo wrote: > >> Conclusion: even if the file is corrupted and normally BTRFS prevent to > >> access it, using O_DIRECT > >> a) no error is returned to the caller >

Re: BUG: BTRFS and O_DIRECT could lead to wrong checksum and wrong data

2017-09-15 Thread Liu Bo
On Fri, Sep 15, 2017 at 12:00:19AM +0200, Goffredo Baroncelli wrote: > Hi all, > > I discovered two bugs when O_DIRECT is used... > > 1) a corrupted file doesn't return -EIO when O_DIRECT is used > > Normally BTRFS prevents to access the contents of a corrupted file; however I > was able read

[PATCH] Btrfs: do not backup tree roots when fsync

2017-09-13 Thread Liu Bo
It doens't make sense to backup tree roots when doing fsync, since during fsync those tree roots have not been consistent on disk. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/disk-io.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/disk-

[PATCH 2/2 v2] Btrfs: remove bio_flags which indicates a meta block of log-tree

2017-09-13 Thread Liu Bo
while the win is that we unify the two places that needs synchronous way and remove a special hack/flag. This removes the bio_flags related stuff for writing log-tree. Signed-off-by: Liu Bo <bo.li@oracle.com> --- v2: Improve the commit log to offer more details why this change makes

[PATCH] Btrfs: fix confusing worker helper info

2017-09-13 Thread Liu Bo
helper function, adding a noinline tag can fix that. Signed-off-by: Liu Bo <bo.li@oracle.com> cc: David Sterba <dste...@suse.cz> --- fs/btrfs/async-thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index ff0

Re: [PATCH 2/2] Btrfs: remove bio_flags which indicates a meta block of log-tree

2017-09-13 Thread Liu Bo
On Wed, Sep 13, 2017 at 06:43:30PM +0200, David Sterba wrote: > On Mon, Aug 21, 2017 at 03:50:00PM -0600, Liu Bo wrote: > > Since both committing transaction and writing log-tree are doing > > plugging on metadata IO, we can unify to use %sync_writers to benefit > > both cases

Re: [PATCH 1/2 RESEND] Btrfs: make plug in writing meta blocks really work

2017-09-13 Thread Liu Bo
On Wed, Sep 13, 2017 at 05:51:55PM +0200, David Sterba wrote: > On Mon, Aug 21, 2017 at 03:49:59PM -0600, Liu Bo wrote: > > We have started plug in btrfs_write_and_wait_marked_extents() but the > > generated IOs actually go to device's schedule IO list where the work > > is

[PATCH RFC] Btrfs: fix confusing worker helper info

2017-09-08 Thread Liu Bo
compiler doing inline for our helper function, adding a noinline tag can fix that. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/async-thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index ff0b0be..59

[PATCH 3/3] Btrfs: remove nr_async_submits and async_submit_draining

2017-09-07 Thread Liu Bo
by shrink_delalloc() as that function doesn't flush twice in the normal case (just issues a writeback with WB_REASON_FS_FREE_SPACE). Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ctree.h | 2 -- fs/btrfs/disk-io.c | 24 fs/btrfs/inode.c

[PATCH 2/3] Btrfs: do not make defrag wait on async_delalloc_pages

2017-09-07 Thread Liu Bo
of defrag option '-c' remains unchanged. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ioctl.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fa1b78c..6dbedd8 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1449,21 +

[PATCH 0/3] kill async counters

2017-09-07 Thread Liu Bo
bdi_write_congested() to do the same job, it's not needed, either. Liu Bo (3): Btrfs: remove nr_async_bios Btrfs: do not make defrag wait on async_delalloc_pages Btrfs: remove nr_async_submits and async_submit_draining fs/btrfs/ctree.h | 3 --- fs/btrfs/disk-io.c | 25

[PATCH 1/3] Btrfs: remove nr_async_bios

2017-09-07 Thread Liu Bo
This was intended to congest higher layers to not send bios, but as 1) the congested bit has been taken by writeback 2) and no one is waiting for %nr_async_bios down to zero, we can safely remove this now. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ctree.h | 1 - fs

Re: [PATCH] Btrfs: avoid wake_up if possible

2017-09-06 Thread Liu Bo
On Wed, Sep 06, 2017 at 04:19:04PM +0200, David Sterba wrote: > On Fri, Sep 01, 2017 at 04:14:27PM -0600, Liu Bo wrote: > > wake_up() will go to check whether someone is on the waiting list with > > holding spin_lock(). > > > > Around some btrfs code, we don't check wai

Re: [PATCH] Btrfs: use the new helper wbc_to_write_flags

2017-09-06 Thread Liu Bo
On Wed, Sep 06, 2017 at 04:38:06PM +0200, David Sterba wrote: > On Thu, Aug 24, 2017 at 06:19:48PM -0600, Liu Bo wrote: > > This updates btrfs to use the helper wbc_to_write_flags which has been > > applied in ext4/xfs/f2fs/block. > > Added in commit 7637241e651ec36e4094 in

Re: Workqueue: events_unbound btrfs_async_reclaim_metadata_space [btrfs]

2017-09-05 Thread Liu Bo
On Tue, Sep 05, 2017 at 11:47:26AM +0200, Marco Lorenzo Crociani wrote: > Hi, > I was transferring some data with rsync to a btrfs filesystem when I got: > > set 04 14:59:05 kernel: INFO: task kworker/u33:2:25015 blocked for more > than 120 seconds. > set 04 14:59:05 kernel: Not tainted

[PATCH] Btrfs: move finish_wait out of the loop

2017-09-01 Thread Liu Bo
If we're still going to wait after schedule(), we don't have to do finish_wait() to remove our %wait_queue_entry since prepare_to_wait() won't add the same %wait_queue_entry twice. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ioctl.c | 2 +- 1 file changed, 1 insertion

[PATCH] Btrfs: remove batch plug in run_scheduled_IO

2017-09-01 Thread Liu Bo
Block layer has a limit on plug, ie. BLK_MAX_REQUEST_COUNT == 16, so we don't gain benefits by batching 64 bios here. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/volumes.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index e

[PATCH] Btrfs: use wait_event instead of a single function

2017-09-01 Thread Liu Bo
Since TASK_UNINTERRUPTIBLE has been used here, wait_event() can do the same job. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ioctl.c | 21 +++-- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 19e4dec..1

[PATCH] Btrfs: protect conditions within root->log_mutex while waiting

2017-09-01 Thread Liu Bo
Both wait_for_commit() and wait_for_writer() are checking the condition out of the mutex lock. This refactors code a bit to be lock safe. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/tree-log.c | 30 -- 1 file changed, 16 insertions(+), 14 del

[PATCH] Btrfs: avoid wake_up if possible

2017-09-01 Thread Liu Bo
(), but these two are the hottest one I've run into so far. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent_io.c| 9 - fs/btrfs/ordered-data.c | 8 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/exten

[PATCH] Btrfs: use the new helper wbc_to_write_flags

2017-08-24 Thread Liu Bo
to get a request or wait. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent_io.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a454a10..825fad6 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/exten

Re: [PATCH] Btrfs: do not reset bio->bi_ops while writing bio

2017-08-24 Thread Liu Bo
On Thu, Aug 24, 2017 at 07:10:41AM -0700, Christoph Hellwig wrote: > On Wed, Aug 23, 2017 at 12:15:09PM -0600, Liu Bo wrote: > > flush_epd_write_bio() sets bio->bi_ops by itself to honor REQ_SYNC, > > but it's not needed at all since bio->bi_ops has set up properly in > &

[PATCH] Btrfs: do not reset bio->bi_ops while writing bio

2017-08-23 Thread Liu Bo
remove this unnecessary bio->bi_ops setting. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent_io.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index b61d68f..a454a10 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/bt

Re: [PATCH 1/6] btrfs: index check-integrity state hash by a dev_t

2017-08-23 Thread Liu Bo
On Wed, Aug 23, 2017 at 07:10:27PM +0200, Christoph Hellwig wrote: > We won't have the struct block_device available in the bio soon, so switch > to the numerical dev_t instead of the block_device pointer for looking up > the check-integrity state. Reviewed-by: Liu Bo <bo.li...

Re: [PATCH 1/7] Btrfs: fix blk_status_t/errno confusion

2017-08-23 Thread Liu Bo
node, > + struct bio *bio, > + int mirror_num) > { > struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); > - int ret; > + blk_status_t ret; > > BUG_ON(bio

[PATCH 1/2 RESEND] Btrfs: make plug in writing meta blocks really work

2017-08-21 Thread Liu Bo
as writing log tree, doing sync submit can merge more IOs. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/disk-io.c | 6 -- fs/btrfs/transaction.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 080e2eb..8

[PATCH 2/2] Btrfs: remove bio_flags which indicates a meta block of log-tree

2017-08-21 Thread Liu Bo
-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/disk-io.c | 6 ++ fs/btrfs/extent_io.c | 13 ++--- fs/btrfs/extent_io.h | 1 - 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8d097ba..b0e353e 100644 --- a/fs/btrfs/dis

Re: [PATCH] Btrfs: make plug in writing meta blocks really work

2017-08-21 Thread Liu Bo
On Mon, Aug 21, 2017 at 03:23:30PM -0400, Josef Bacik wrote: > On Mon, Aug 21, 2017 at 12:14:16PM -0700, Liu Bo wrote: > > On Mon, Aug 21, 2017 at 01:48:01PM -0400, Josef Bacik wrote: > > > On Fri, Aug 18, 2017 at 11:42:07AM -0600, Liu Bo wrote: > >

Re: [PATCH] Btrfs: make plug in writing meta blocks really work

2017-08-21 Thread Liu Bo
On Mon, Aug 21, 2017 at 01:48:01PM -0400, Josef Bacik wrote: > On Fri, Aug 18, 2017 at 11:42:07AM -0600, Liu Bo wrote: > > We have started plug in btrfs_write_and_wait_marked_extents() but the > > generated IOs actually go to device's schedule IO list where the work > > is

Re: [PATCH v2] btrfs: submit superblock io with REQ_META and REQ_PRIO

2017-08-21 Thread Liu Bo
effectively block the whole transaction, also blocking any other > operation holding the device_list_mutex. > Reviewed-by: Liu Bo <bo.li@oracle.com> -liubo > Signed-off-by: David Sterba <dste...@suse.com> > --- > fs/btrfs/disk-io.c | 5 +++-- > 1 file changed,

[PATCH v3 3/7] Btrfs: remove BUG() in btrfs_extent_inline_ref_size

2017-08-18 Thread Liu Bo
Now that btrfs_get_extent_inline_ref_type() can report if type is a valid one and all callers can gracefully deal with that, we don't need to crash here. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/ctree.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/ctree.

[PATCH v3 7/7] Btrfs: add one more sanity check for shared ref type

2017-08-18 Thread Liu Bo
misused. This adds the above mentioned check and also updates print_extent_item() called by btrfs_print_leaf() to point out the invalid ref while printing the tree structure. Signed-off-by: Liu Bo <bo.li@oracle.com> --- fs/btrfs/extent-tree.c | 29 + fs/btrfs

[PATCH v3 0/7] add sanity check for extent inline ref type

2017-08-18 Thread Liu Bo
err so that we know which btrfs has that error. v2: - add enum type and return BTRFS_REF_TYPE_INVALID instead of -EINVAL. - remove one more BUG_ON which is in __add_tree_block. - add validation check for shared refs. - improve btrfs_print_leaf to show which refs has something wrong. Liu Bo

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