Skip to content

Commit 15fdaf2

Browse files
Matthew Wilcox (Oracle)brauner
authored andcommitted
ceph: Convert ceph_check_page_before_write() to use a folio
Remove the conversion back to a struct page and just use the folio passed in. Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org> Link: https://lore.kernel.org/r/20250217185119.430193-7-willy@infradead.org Tested-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 62171c1 commit 15fdaf2

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

fs/ceph/addr.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,18 +1132,17 @@ int ceph_check_page_before_write(struct address_space *mapping,
11321132
struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
11331133
struct ceph_client *cl = fsc->client;
11341134
struct ceph_snap_context *pgsnapc;
1135-
struct page *page = &folio->page;
11361135

1137-
/* only dirty pages, or our accounting breaks */
1138-
if (unlikely(!PageDirty(page)) || unlikely(page->mapping != mapping)) {
1139-
doutc(cl, "!dirty or !mapping %p\n", page);
1136+
/* only dirty folios, or our accounting breaks */
1137+
if (unlikely(!folio_test_dirty(folio) || folio->mapping != mapping)) {
1138+
doutc(cl, "!dirty or !mapping %p\n", folio);
11401139
return -ENODATA;
11411140
}
11421141

11431142
/* only if matching snap context */
1144-
pgsnapc = page_snap_context(page);
1143+
pgsnapc = page_snap_context(&folio->page);
11451144
if (pgsnapc != ceph_wbc->snapc) {
1146-
doutc(cl, "page snapc %p %lld != oldest %p %lld\n",
1145+
doutc(cl, "folio snapc %p %lld != oldest %p %lld\n",
11471146
pgsnapc, pgsnapc->seq,
11481147
ceph_wbc->snapc, ceph_wbc->snapc->seq);
11491148

@@ -1154,7 +1153,7 @@ int ceph_check_page_before_write(struct address_space *mapping,
11541153
return -ENODATA;
11551154
}
11561155

1157-
if (page_offset(page) >= ceph_wbc->i_size) {
1156+
if (folio_pos(folio) >= ceph_wbc->i_size) {
11581157
doutc(cl, "folio at %lu beyond eof %llu\n",
11591158
folio->index, ceph_wbc->i_size);
11601159

@@ -1167,8 +1166,8 @@ int ceph_check_page_before_write(struct address_space *mapping,
11671166
}
11681167

11691168
if (ceph_wbc->strip_unit_end &&
1170-
(page->index > ceph_wbc->strip_unit_end)) {
1171-
doutc(cl, "end of strip unit %p\n", page);
1169+
(folio->index > ceph_wbc->strip_unit_end)) {
1170+
doutc(cl, "end of strip unit %p\n", folio);
11721171
return -E2BIG;
11731172
}
11741173

0 commit comments

Comments
 (0)