From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 3/3] btrfs: Use for loop in prealloc_file_extent_cluster
Date: Wed, 17 Jun 2020 12:10:44 +0300 [thread overview]
Message-ID: <20200617091044.27846-4-nborisov@suse.com> (raw)
In-Reply-To: <20200617091044.27846-1-nborisov@suse.com>
This function iterates all extents in the extent cluster, make this
intention obvious by using a for loop. No functional chanes.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/relocation.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 020d04035be1..8972aa574a05 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2580,7 +2580,7 @@ int prealloc_file_extent_cluster(struct inode *inode,
u64 end;
u64 offset = BTRFS_I(inode)->index_cnt;
u64 num_bytes;
- int nr = 0;
+ int nr;
int ret = 0;
u64 prealloc_start = cluster->start - offset;
u64 prealloc_end = cluster->end - offset;
@@ -2593,7 +2593,7 @@ int prealloc_file_extent_cluster(struct inode *inode,
return ret;
inode_lock(inode);
- while (nr < cluster->nr) {
+ for (nr = 0; nr < cluster->nr; nr++) {
start = cluster->boundary[nr] - offset;
if (nr + 1 < cluster->nr)
end = cluster->boundary[nr + 1] - 1 - offset;
@@ -2609,7 +2609,6 @@ int prealloc_file_extent_cluster(struct inode *inode,
unlock_extent(&BTRFS_I(inode)->io_tree, start, end);
if (ret)
break;
- nr++;
}
inode_unlock(inode);
--
2.17.1
next prev parent reply other threads:[~2020-06-17 9:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 9:10 [PATCH 0/3] Refactor prealloc_file_extent_cluster Nikolay Borisov
2020-06-17 9:10 ` [PATCH 1/3] btrfs: Remove hole check in prealloc_file_extent_cluster Nikolay Borisov
2020-06-17 12:57 ` Johannes Thumshirn
2020-06-17 16:22 ` David Sterba
2020-06-17 9:10 ` [PATCH 2/3] btrfs: Perform data management operations outside of inode lock Nikolay Borisov
2020-06-17 12:54 ` Johannes Thumshirn
2020-06-17 9:10 ` Nikolay Borisov [this message]
2020-06-17 13:02 ` [PATCH 3/3] btrfs: Use for loop in prealloc_file_extent_cluster Johannes Thumshirn
2020-06-17 13:18 ` Nikolay Borisov
2020-06-17 16:38 ` [PATCH 0/3] Refactor prealloc_file_extent_cluster David Sterba
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=20200617091044.27846-4-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