[PATCH] btrfs: balance dirty metadata pages in btrfs_finish_ordered_io

2018-04-27 Thread Ethan Lien
uming dirty pages. Also, we use different worker for metadata writeback endio, sleep in btrfs_finish_ordered_io help us throttle the size of dirty metadata pages. Signed-off-by: Ethan Lien --- fs/btrfs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c

[PATCH v3] btrfs: use customized batch size for total_bytes_pinned

2018-07-13 Thread Ethan Lien
atch can really reduce cacheline bouncing of spin lock (also the global counter of percpu_counter) in a SMP system. Fixes: b150a4f10d878 ("Btrfs: use a percpu to keep track of possibly pinned bytes") Signed-off-by: Ethan Lien --- V2: Rewrite commit comments. Add lock_stat test. Pull

[PATCH] btrfs: use tagged writepage to mitigate livelock of snapshot

2018-10-31 Thread Ethan Lien
quential write case, since we omit only half of the pages dirtied after snapshot command. Signed-off-by: Ethan Lien --- fs/btrfs/btrfs_inode.h | 1 + fs/btrfs/ctree.h | 2 +- fs/btrfs/extent_io.c | 16 ++-- fs/btrfs/inode.c | 10 ++ fs/btrfs/ioctl.c | 2 +-

[PATCH v2] btrfs: use tagged writepage to mitigate livelock of snapshot

2018-11-02 Thread Ethan Lien
/mnt/sub /mnt/snap; killall fio original: 15.83sec patched: 10.35sec The improvement is less compared with the sequential write case, since we omit only half of the pages dirtied after snapshot command. Signed-off-by: Ethan Lien --- V2: Add more details in commit message.

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

2018-05-16 Thread Ethan Lien
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 --- fs/btrfs/inode.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/btrfs/inode.c b/fs

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

2018-05-16 Thread Ethan Lien
% performance gain. As we continually write to the same file, all writes will resume to nocow mode and eventually we have no performance gain. Signed-off-by: Ethan Lien --- V2: Add comment and performance test. fs/btrfs/inode.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a

[PATCH v2] btrfs: balance dirty metadata pages in btrfs_finish_ordered_io

2018-05-27 Thread Ethan Lien
delayed work is completed. 6) Start all fio. Few seconds later we hit OOM when the flusher starts to work. It can be reproduced even when using nocow write. Signed-off-by: Ethan Lien --- V2: Replace btrfs_btree_balance_dirty with btrfs_btree_balance_dirty_nodelay. Add r

[PATCH] btrfs: use customized batch size for total_bytes_pinned

2018-06-29 Thread Ethan Lien
total_bytes_pinned as we already done for dirty_metadata_bytes and delalloc_bytes. Also we fix dirty_metadata_bytes to use __percpu_counter_compare of customized batch so we get precise value of dirty_metadata_bytes. Signed-off-by: Ethan Lien --- fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c | 10

[PATCH] btrfs: use correct compare function of dirty_metadata_bytes

2018-07-02 Thread Ethan Lien
We use customized, nodesize batch value to update dirty_metadata_bytes. We should also use batch version of compare function or we will easily goto fast path and get false result from percpu_counter_compare(). Signed-off-by: Ethan Lien --- fs/btrfs/disk-io.c | 10 ++ 1 file changed, 6

[PATCH v2] btrfs: use customized batch size for total_bytes_pinned

2018-07-11 Thread Ethan Lien
atch can really recude cacheline bouncing of spin lock (also the global counter of percpu_counter) in a SMP system. Fixes: b150a4f10d878 ("Btrfs: use a percpu to keep track of possibly pinned bytes") Signed-off-by: Ethan Lien --- V2: Rewrite commit comments. Add loc