From: Timofey Titovets <nefelim4ag@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Timofey Titovets <nefelim4ag@gmail.com>
Subject: [RFC PATCH] Btrfs: clear_dirty only on pages in compression range
Date: Wed, 23 Aug 2017 20:23:29 +0300 [thread overview]
Message-ID: <20170823172329.5794-1-nefelim4ag@gmail.com> (raw)
At now while compressing data range code touch dirty
page status on whole range on each 128kb iteration, that's costs time
As we care only about page status in range that will be compressed
in current iteration, let's touch dirty status only for actual
compression range
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
---
fs/btrfs/inode.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2b92478fe7ec..cb7779b08aaf 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -449,6 +449,7 @@ static noinline void compress_file_range(struct inode *inode,
u64 num_bytes;
u64 blocksize = fs_info->sectorsize;
u64 actual_end;
+ u64 compress_range_end;
u64 isize = i_size_read(inode);
int ret = 0;
struct page **pages = NULL;
@@ -500,6 +501,8 @@ static noinline void compress_file_range(struct inode *inode,
num_bytes = max(blocksize, num_bytes);
total_in = 0;
ret = 0;
+ compress_range_end = start + min_t(u64, BTRFS_MAX_UNCOMPRESSED,
+ end - start);
/*
* we do compression for mount -o compress and when the
@@ -528,7 +531,8 @@ static noinline void compress_file_range(struct inode *inode,
* If the compression fails for any reason, we set the pages
* dirty again later on.
*/
- extent_range_clear_dirty_for_io(inode, start, end);
+ extent_range_clear_dirty_for_io(inode, start,
+ compress_range_end);
redirty = 1;
ret = btrfs_compress_pages(compress_type,
inode->i_mapping, start,
@@ -667,7 +671,7 @@ static noinline void compress_file_range(struct inode *inode,
/* unlocked later on in the async handlers */
if (redirty)
- extent_range_redirty_for_io(inode, start, end);
+ extent_range_redirty_for_io(inode, start, compress_range_end);
add_async_extent(async_cow, start, end - start + 1, 0, NULL, 0,
BTRFS_COMPRESS_NONE);
*num_added += 1;
--
2.14.1
reply other threads:[~2017-08-23 17:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170823172329.5794-1-nefelim4ag@gmail.com \
--to=nefelim4ag@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).