From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH v3 6/6] btrfs: Factor out common extent locking code in submit_compressed_extents
Date: Thu, 21 Feb 2019 13:57:17 +0200 [thread overview]
Message-ID: <20190221115717.5128-7-nborisov@suse.com> (raw)
In-Reply-To: <20190221115717.5128-1-nborisov@suse.com>
Irrespective of whether the compress code fell back to uncompressed or
a compressed extent has to be submitted, the extent range is always
locked. So factor out the common lock_extent call at the beginning of
the loop. No functional changes just removes one duplicate lock_extent
call.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
fs/btrfs/inode.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index bfd0e934a098..edeb9da6b27e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -736,15 +736,14 @@ static noinline void submit_compressed_extents(struct async_chunk *async_cow)
struct async_extent, list);
list_del(&async_extent->list);
retry:
+
+ lock_extent(io_tree, async_extent->start,
+ async_extent->start + async_extent->ram_size - 1);
/* did the compression code fall back to uncompressed IO? */
if (!async_extent->pages) {
int page_started = 0;
unsigned long nr_written = 0;
- lock_extent(io_tree, async_extent->start,
- async_extent->start +
- async_extent->ram_size - 1);
-
/* allocate blocks */
ret = cow_file_range(inode, async_cow->locked_page,
async_extent->start,
@@ -776,9 +775,6 @@ static noinline void submit_compressed_extents(struct async_chunk *async_cow)
continue;
}
- lock_extent(io_tree, async_extent->start,
- async_extent->start + async_extent->ram_size - 1);
-
ret = btrfs_reserve_extent(root, async_extent->ram_size,
async_extent->compressed_size,
async_extent->compressed_size,
--
2.17.1
prev parent reply other threads:[~2019-02-21 11:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 11:57 [PATCH v3 0/6] Compress path cleanups Nikolay Borisov
2019-02-21 11:57 ` [PATCH v3 1/6] btrfs: Refactor cow_file_range_async Nikolay Borisov
2019-02-21 13:15 ` Johannes Thumshirn
2019-02-21 13:25 ` Nikolay Borisov
2019-02-21 15:07 ` Johannes Thumshirn
2019-02-21 15:09 ` Nikolay Borisov
2019-02-22 18:05 ` David Sterba
2019-02-22 18:13 ` David Sterba
2019-02-21 11:57 ` [PATCH v3 2/6] btrfs: Remove fs_info from struct async_chunk Nikolay Borisov
2019-02-21 13:07 ` Johannes Thumshirn
2019-02-21 11:57 ` [PATCH v3 3/6] btrfs: Make compress_file_range take only " Nikolay Borisov
2019-02-21 13:07 ` Johannes Thumshirn
2019-02-21 11:57 ` [PATCH v3 4/6] btrfs: Replace clear_extent_bit with unlock_extent Nikolay Borisov
2019-02-21 11:57 ` [PATCH v3 5/6] btrfs: Set iotree only once in submit_compressed_extents Nikolay Borisov
2019-02-21 11:57 ` Nikolay Borisov [this message]
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=20190221115717.5128-7-nborisov@suse.com \
--to=nborisov@suse.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).