Skip to content

Commit 4066986

Browse files
Daniel Vacekkdave
authored andcommitted
btrfs: move folio initialization to one place in attach_eb_folio_to_filemap()
This is just a trivial change. The code looks a bit more readable this way, IMO. Move initialization of existing_folio to the beginning of the retry loop so it's set to NULL at one place. Signed-off-by: Daniel Vacek <neelx@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c779b79 commit 4066986

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fs/btrfs/extent_io.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,7 +3107,7 @@ static int attach_eb_folio_to_filemap(struct extent_buffer *eb, int i,
31073107
struct btrfs_fs_info *fs_info = eb->fs_info;
31083108
struct address_space *mapping = fs_info->btree_inode->i_mapping;
31093109
const unsigned long index = eb->start >> PAGE_SHIFT;
3110-
struct folio *existing_folio = NULL;
3110+
struct folio *existing_folio;
31113111
int ret;
31123112

31133113
ASSERT(found_eb_ret);
@@ -3116,17 +3116,16 @@ static int attach_eb_folio_to_filemap(struct extent_buffer *eb, int i,
31163116
ASSERT(eb->folios[i]);
31173117

31183118
retry:
3119+
existing_folio = NULL;
31193120
ret = filemap_add_folio(mapping, eb->folios[i], index + i,
31203121
GFP_NOFS | __GFP_NOFAIL);
31213122
if (!ret)
31223123
goto finish;
31233124

31243125
existing_folio = filemap_lock_folio(mapping, index + i);
31253126
/* The page cache only exists for a very short time, just retry. */
3126-
if (IS_ERR(existing_folio)) {
3127-
existing_folio = NULL;
3127+
if (IS_ERR(existing_folio))
31283128
goto retry;
3129-
}
31303129

31313130
/* For now, we should only have single-page folios for btree inode. */
31323131
ASSERT(folio_nr_pages(existing_folio) == 1);

0 commit comments

Comments
 (0)