Skip to content

Commit 3a19caf

Browse files
Matthew Wilcox (Oracle)Jaegeuk Kim
authored andcommitted
f2fs: Convert get_next_nat_page() to get_next_nat_folio()
Return a folio from this function and convert its one caller. Removes a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 9e3d138 commit 3a19caf

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

fs/f2fs/node.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static struct folio *get_current_nat_folio(struct f2fs_sb_info *sbi, nid_t nid)
135135
return f2fs_get_meta_folio_retry(sbi, current_nat_addr(sbi, nid));
136136
}
137137

138-
static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid)
138+
static struct folio *get_next_nat_folio(struct f2fs_sb_info *sbi, nid_t nid)
139139
{
140140
struct folio *src_folio;
141141
struct folio *dst_folio;
@@ -149,7 +149,7 @@ static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid)
149149
/* get current nat block page with lock */
150150
src_folio = get_current_nat_folio(sbi, nid);
151151
if (IS_ERR(src_folio))
152-
return &src_folio->page;
152+
return src_folio;
153153
dst_folio = f2fs_grab_meta_folio(sbi, dst_off);
154154
f2fs_bug_on(sbi, folio_test_dirty(src_folio));
155155

@@ -161,7 +161,7 @@ static struct page *get_next_nat_page(struct f2fs_sb_info *sbi, nid_t nid)
161161

162162
set_to_next_nat(nm_i, nid);
163163

164-
return &dst_folio->page;
164+
return dst_folio;
165165
}
166166

167167
static struct nat_entry *__alloc_nat_entry(struct f2fs_sb_info *sbi,
@@ -3010,7 +3010,7 @@ static int __flush_nat_entry_set(struct f2fs_sb_info *sbi,
30103010
bool to_journal = true;
30113011
struct f2fs_nat_block *nat_blk;
30123012
struct nat_entry *ne, *cur;
3013-
struct page *page = NULL;
3013+
struct folio *folio = NULL;
30143014

30153015
/*
30163016
* there are two steps to flush nat entries:
@@ -3024,11 +3024,11 @@ static int __flush_nat_entry_set(struct f2fs_sb_info *sbi,
30243024
if (to_journal) {
30253025
down_write(&curseg->journal_rwsem);
30263026
} else {
3027-
page = get_next_nat_page(sbi, start_nid);
3028-
if (IS_ERR(page))
3029-
return PTR_ERR(page);
3027+
folio = get_next_nat_folio(sbi, start_nid);
3028+
if (IS_ERR(folio))
3029+
return PTR_ERR(folio);
30303030

3031-
nat_blk = page_address(page);
3031+
nat_blk = folio_address(folio);
30323032
f2fs_bug_on(sbi, !nat_blk);
30333033
}
30343034

@@ -3064,8 +3064,8 @@ static int __flush_nat_entry_set(struct f2fs_sb_info *sbi,
30643064
if (to_journal) {
30653065
up_write(&curseg->journal_rwsem);
30663066
} else {
3067-
__update_nat_bits(sbi, start_nid, page);
3068-
f2fs_put_page(page, 1);
3067+
__update_nat_bits(sbi, start_nid, &folio->page);
3068+
f2fs_folio_put(folio, true);
30693069
}
30703070

30713071
/* Allow dirty nats by node block allocation in write_begin */

0 commit comments

Comments
 (0)