btrfs: a small cleanup in attach_eb_folio_to_filemap()
PATCH 1/1 btrfs: a small cleanup in attach_eb_folio_to_filemap()
This is just a trivial change. The code looks a bit more readable this way, IMO.
Signed-off-by Daniel Vacek <[email protected]>
--- fs/btrfs/extent_io.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/btrfs/extent_io.c +3 -4
@@ -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 );
Signature · 1 line
2.47.2
Quoted 1 line · Daniel Vacek
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.
Quoted 1 line
Signed-off-by Daniel Vacek <[email protected]>
Reviewed-by David Sterba <[email protected]>