fs/btrfs/extent_io.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
This is just a trivial change. The code looks a bit more readable this way, IMO.
Signed-off-by: Daniel Vacek <neelx@suse.com>
---
fs/btrfs/extent_io.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 7023dd527d3e7..cab4cc5583400 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3139,7 +3139,7 @@ static int attach_eb_folio_to_filemap(struct extent_buffer *eb, int i,
struct btrfs_fs_info *fs_info = eb->fs_info;
struct address_space *mapping = fs_info->btree_inode->i_mapping;
const unsigned long index = eb->start >> PAGE_SHIFT;
- struct folio *existing_folio = NULL;
+ struct folio *existing_folio;
int ret;
ASSERT(found_eb_ret);
@@ -3148,6 +3148,7 @@ static int attach_eb_folio_to_filemap(struct extent_buffer *eb, int i,
ASSERT(eb->folios[i]);
retry:
+ existing_folio = NULL;
ret = filemap_add_folio(mapping, eb->folios[i], index + i,
GFP_NOFS | __GFP_NOFAIL);
if (!ret)
@@ -3155,10 +3156,8 @@ static int attach_eb_folio_to_filemap(struct extent_buffer *eb, int i,
existing_folio = filemap_lock_folio(mapping, index + i);
/* The page cache only exists for a very short time, just retry. */
- if (IS_ERR(existing_folio)) {
- existing_folio = NULL;
+ if (IS_ERR(existing_folio))
goto retry;
- }
/* For now, we should only have single-page folios for btree inode. */
ASSERT(folio_nr_pages(existing_folio) == 1);
--
2.47.2
On Wed, Apr 23, 2025 at 10:51:22AM +0200, Daniel Vacek wrote: > This is just a trivial change. The code looks a bit more readable this way, IMO. Please be more descriptive in the changelogs, the subject and text is too generic. Something like "move the initializations of folio to the beginning of the retry loop". Otherwise agreed taht it's better this way. I'll update the changelog when adding it to for-next. Thanks. > Signed-off-by: Daniel Vacek <neelx@suse.com> Reviewed-by: David Sterba <dsterba@suse.com>
© 2016 - 2025 Red Hat, Inc.