netfs, 9p, afs, ceph: Support folios, at least partially
Subsystems (12)
David Howells
maintainerv3 cover netfs, 9p, afs, ceph: Support folios, at least partially
Here's a set of patches to convert netfs, 9p and afs to use folios and to provide sufficient conversion for ceph that it can continue to use the netfs library. Jeff Layton is working on fully converting ceph.
This also contains a patch to split afs symlink readpage from afs file readpage to aid with foliation and a patch to convert 9p to netfslib to reduce the amount of foliation needed there.
Changes
=======
ver #3:
- Rebased on upstream as folios have been pulled.
- Imported a patch to convert 9p to netfslib from my fscache-remove-old-api branch[3].
- Foliated netfslib.
ver #2:
- Reorder the patches to put both non-folio afs patches to the front.
- Use page_offset() rather than manual calculation[1].
- Fix folio_inode() to directly access the inode[2].
David
---
David Howells (6):
afs: Sort out symlink reading
9p: Convert to using the netfs helper lib to do reads and caching
folio: Add a function to change the private data attached to a folio
folio: Add a function to get the host inode for a folio netfs, 9p, afs, ceph: Use folios
afs: Use folios in directory handling
fs/9p/Kconfig | 1 + fs/9p/cache.c | 137 --------------- fs/9p/cache.h | 97 +---------- fs/9p/v9fs.h | 9 + fs/9p/vfs_addr.c | 253 +++++++++++++-------------- fs/9p/vfs_file.c | 29 ++-- fs/afs/dir.c | 229 ++++++++++-------------- fs/afs/dir_edit.c | 154 +++++++++-------- fs/afs/file.c | 70 ++++---- fs/afs/internal.h | 46 ++--- fs/afs/write.c | 346 ++++++++++++++++++------------------- fs/ceph/addr.c | 80 +++++---- fs/netfs/read_helper.c | 165 +++++++++--------- include/linux/netfs.h | 12 +- include/linux/pagemap.h | 33 ++++ include/trace/events/afs.h | 21 +-- mm/page-writeback.c | 2 +- 17 files changed, 738 insertions(+), 946 deletions(-)
David Howells
maintainerPATCH v3 1/6 afs: Sort out symlink reading
afs_readpage() doesn't get a file pointer when called for a symlink, so separate it from regular file pointer handling.
---
fs/afs/file.c | 14 +++++++++----- fs/afs/inode.c | 6 +++--- fs/afs/internal.h | 3 ++- 3 files changed, 14 insertions(+), 9 deletions(-)
fs/afs/file.c +9 -5
@@ -19,6 +19,7 @@static int afs_file_mmap (struct file *file,struct vm_area_struct *vma);static int afs_readpage (struct file *file,struct page *page); +static int afs_symlink_readpage (struct file *file,struct page *page);static void afs_invalidatepage (struct page *page,unsigned int offset,unsigned int length);static int afs_releasepage (struct page *page,gfp_t gfp_flags);
@@ -49,7 +50,7 @@ const struct inode_operations afs_file_inode_operations = { .permission = afs_permission, }; -const struct address_space_operations afs_fs_aops = { +const struct address_space_operations afs_file_aops = { .readpage = afs_readpage, .readahead = afs_readahead, .set_page_dirty = afs_set_page_dirty,
@@ -62,6 +63,12 @@ const struct address_space_operations afs_fs_aops = { .writepages = afs_writepages, }; +const struct address_space_operations afs_symlink_aops = { + .readpage = afs_symlink_readpage, + .releasepage = afs_releasepage, + .invalidatepage = afs_invalidatepage, +}; +static const struct vm_operations_struct afs_vm_ops = { .open = afs_vm_open, .close = afs_vm_close,
@@ -313,7 +320,7 @@ static void afs_req_issue_op(struct netfs_read_subrequest *subreq)afs_put_read (fsreq); } -static int afs_symlink_readpage (struct page *page) +static int afs_symlink_readpage (struct file *file,struct page *page) {struct afs_vnode *vnode =AFS_FS_I (page->mapping->host);struct afs_read *fsreq;
@@ -378,9 +385,6 @@ const struct netfs_read_request_ops afs_req_ops = {static int afs_readpage (struct file *file,struct page *page) { -if (!file) -return afs_symlink_readpage (page); -return netfs_readpage (file, page, &afs_req_ops,NULL ); }
fs/afs/inode.c +3 -3
@@ -95,7 +95,7 @@ static int afs_inode_init_from_status(struct afs_operation *op, inode->i_mode =S_IFREG | (status->mode &S_IALLUGO ); inode->i_op = &afs_file_inode_operations; inode->i_fop = &afs_file_operations; - inode->i_mapping->a_ops = &afs_fs_aops; + inode->i_mapping->a_ops = &afs_file_aops;break ;case AFS_FTYPE_DIR : inode->i_mode =S_IFDIR | (status->mode &S_IALLUGO );
@@ -113,11 +113,11 @@ static int afs_inode_init_from_status(struct afs_operation *op, inode->i_mode =S_IFDIR |0555 ; inode->i_op = &afs_mntpt_inode_operations; inode->i_fop = &afs_mntpt_file_operations; - inode->i_mapping->a_ops = &afs_fs_aops; + inode->i_mapping->a_ops = &afs_symlink_aops; }else { inode->i_mode =S_IFLNK | status->mode; inode->i_op = &afs_symlink_inode_operations; - inode->i_mapping->a_ops = &afs_fs_aops; + inode->i_mapping->a_ops = &afs_symlink_aops; }inode_nohighmem (inode);break ;
fs/afs/internal.h +2 -1
@@ -1055,7 +1055,8 @@ extern void afs_dynroot_depopulate(struct super_block *);/* * file.c */ -extern const struct address_space_operations afs_fs_aops; +extern const struct address_space_operations afs_file_aops; +extern const struct address_space_operations afs_symlink_aops;extern const struct inode_operations afs_file_inode_operations;extern const struct file_operations afs_file_operations;extern const struct netfs_read_request_ops afs_req_ops;
David Howells
maintainerPATCH v3 2/6 9p: Convert to using the netfs helper lib to do reads and caching
In reply to David HowellsConvert the 9p filesystem to use the netfs helper lib to handle readpage, readahead and write_begin, converting those into a common issue_op for the filesystem itself to handle. The netfs helper lib also handles reading from fscache if a cache is available, and interleaving reads from both sources.
This change also switches from the old fscache I/O API to the new one, meaning that fscache no longer keeps track of netfs pages and instead does async DIO between the backing files and the 9p file pagecache. As a part of this change, the handling of PG_fscache changes. It now just means that the cache has a write I/O operation in progress on a page (PG_locked is used for a read I/O op).
Note that this is a cut-down version of the fscache rewrite and does not change any of the cookie and cache coherency handling.
Changes
=======
ver #4:
- Rebase on top of folios.
- Don't use wait_on_page_bit_killable().
ver #3:
- v9fs_req_issue_op() needs to terminate the subrequest.
- v9fs_write_end() needs to call SetPageUptodate() a bit more often.
- It's not CONFIG_{AFS,V9FS}_FSCACHE[1]
- v9fs_init_rreq() should take a ref on the p9_fid and the cleanup should drop it [from Dominique Martinet].
---
fs/9p/Kconfig | 1 fs/9p/cache.c | 137 -------------------------------------- fs/9p/cache.h | 97 +-------------------------- fs/9p/v9fs.h | 9 ++ fs/9p/vfs_addr.c | 195 +++++++++++++++++++++++++++--------------------------- fs/9p/vfs_file.c | 17 ++++- 6 files changed, 122 insertions(+), 334 deletions(-)
fs/9p/Kconfig +1 -0
@@ -2,6 +2,7 @@ config 9P_FS tristate "Plan 9 Resource Sharing Support (9P2000)" depends on INET && NET_9P + select NETFS_SUPPORT help If you say Y here, you will get experimental support for Plan 9 resource sharing via the 9P2000 protocol.
fs/9p/cache.c +0 -137
140 lines not on this page · raw message
fs/9p/cache.h +3 -94
115 lines not on this page · raw message
fs/9p/v9fs.h +9 -0
@@ -124,6 +124,15 @@ static inline struct v9fs_inode *V9FS_I(const struct inode *inode) return container_of(inode, struct v9fs_inode, vfs_inode); } +static inline struct fscache_cookie *v9fs_inode_cookie (struct v9fs_inode *v9inode) +{ +#ifdef CONFIG_9P_FSCACHE +return v9inode->fscache; +#else +return NULL ; +#endif +} +extern int v9fs_show_options (struct seq_file *m,struct dentry *root); struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
fs/9p/vfs_addr.c +96 -99
302 lines not on this page · raw message
fs/9p/vfs_file.c +13 -4
@@ -537,14 +537,23 @@ v9fs_vm_page_mkwrite(struct vm_fault *vmf)p9_debug (P9_DEBUG_VFS ,"page %p fid %lx\n" , page, (unsigned long )filp->private_data); + v9inode =V9FS_I (inode); + +/* Wait for the page to be written to the cache before we allow it to +* be modified. We then assume the entire page will need writing back. +*/ +#ifdef CONFIG_9P_FSCACHE +if (PageFsCache (page) && +wait_on_page_fscache_killable (page) <0 ) +return VM_FAULT_RETRY ; +#endif +/* Update file times before taking page lock */ file_update_time (filp); - v9inode =V9FS_I (inode); -/* make sure the cache has finished storing the page */ -v9fs_fscache_wait_on_page_write (inode, page);BUG_ON (!v9inode->writeback_fid); -lock_page (page); +if (lock_page_killable (page) <0 ) +return VM_FAULT_RETRY ;if (page->mapping != inode->i_mapping) goto out_unlock;wait_for_stable_page (page);
David Howells
maintainerPATCH v3 3/6 folio: Add a function to change the private data attached to a folio
In reply to David HowellsAdd a function, folio_change_private(), that will change the private data attached to a folio, without the need to twiddle the private bit or the refcount. It assumes that folio_add_private() has already been called on the page.
---
include/linux/pagemap.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
include/linux/pagemap.h +19 -0
@@ -229,6 +229,25 @@ static inline void folio_attach_private(struct folio *folio, void *data)folio_set_private (folio); } +/** +* folio_change_private - Change private data on a folio. +* @folio: Folio to change the data on. +* @data: Data to set on the folio. +* +* Change the private data attached to a folio and return the old +* data. The page must previously have had data attached and the data +* must be detached before the folio will be freed. +* +* Return: Data that was previously attached to the folio. +*/ +static inline void *folio_change_private (struct folio *folio,void *data) +{ +void *old =folio_get_private (folio); + + folio->private = data; +return old; +} +/** * folio_detach_private - Detach private data from a folio. * @folio: Folio to detach data from.
David Howells
maintainerPATCH v3 4/6 folio: Add a function to get the host inode for a folio
In reply to David HowellsAdd a convenience function, folio_inode() that will get the host inode from a folio's mapping.
Changes:
ver #2:
- Fix contradiction between doc and implementation by disallowing use with swap caches[1].
---
include/linux/pagemap.h | 14 ++++++++++++++ mm/page-writeback.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-)
include/linux/pagemap.h +14 -0
@@ -203,6 +203,20 @@ static inline struct address_space *page_mapping_file(struct page *page)return folio_mapping (folio); } +/** +* folio_inode - Get the host inode for this folio. +* @folio: The folio. +* +* For folios which are in the page cache, return the inode that is hosting +* this folio belongs to. +* +* Do not call this for folios which aren't in the page cache. +*/ +static inline struct inode *folio_inode (struct folio *folio) +{ +return folio->mapping->host; +} +static inline bool page_cache_add_speculative (struct page *page,int count) {VM_BUG_ON_PAGE (PageTail (page), page);
mm/page-writeback.c +1 -1
@@ -2960,7 +2960,7 @@ EXPORT_SYMBOL_GPL(folio_wait_writeback_killable);*/ void folio_wait_stable (struct folio *folio) { -if (folio->mapping->host->i_sb->s_iflags &SB_I_STABLE_WRITES ) +if (folio_inode (folio)->i_sb->s_iflags &SB_I_STABLE_WRITES )folio_wait_writeback (folio); }EXPORT_SYMBOL_GPL (folio_wait_stable);
Re: [PATCH v3 4/6] folio: Add a function to get the host inode for a folio
Quoted 2 lines · David Howells
Add a convenience function,
folio_inode()that will get the host inode from a folio's mapping.
I'm not opposed, but it only saves two characters, so I'm not entirely sure it justifies its existance. On the other hand, folio_inode() is clear about what it does.
Quoted 2 lines
+ * For folios which are in the page cache, return the inode that is hosting
+ * this folio belongs to.
This looks like an editing mistake. Either you meant 'return the inode that hosts this folio' or 'return the inode this folio belongs to'
(and i prefer the second).
With that grammo fixed,
David Howells
maintainerRe: [PATCH v3 4/6] folio: Add a function to get the host inode for a folio
Quoted 7 lines · Matthew Wilcox
Quoted 2 lines
+ * For folios which are in the page cache, return the inode that is hosting
+ * this folio belongs to.This looks like an editing mistake. Either you meant 'return the inode that hosts this folio' or 'return the inode this folio belongs to'
(and i prefer the second).
Yeah - I'll go with that.
David
David Howells
maintainerPATCH v3 5/6 netfs, 9p, afs, ceph: Use folios
In reply to David HowellsConvert the netfs helper library to use folios throughout, convert the 9p and afs filesystems to use folios in their file I/O paths and convert the ceph filesystem to use just enough folios to compile.
With these changes, afs passes -g quick xfstests.
Changes
=======
ver #2:
- Add 9p foliation.
---
fs/9p/vfs_addr.c | 78 +++++----- fs/9p/vfs_file.c | 20 +-- fs/afs/file.c | 70 +++++---- fs/afs/internal.h | 46 +++--- fs/afs/write.c | 346 +++++++++++++++++++++----------------------- fs/ceph/addr.c | 80 +++++----- fs/netfs/read_helper.c | 165 +++++++++++---------- include/linux/netfs.h | 12 +- include/trace/events/afs.h | 21 +-- 9 files changed, 422 insertions(+), 416 deletions(-)
fs/9p/vfs_addr.c +42 -36
@@ -110,7 +110,9 @@ static const struct netfs_read_request_ops v9fs_req_ops = {*/ static int v9fs_vfs_readpage (struct file *file,struct page *page) { -return netfs_readpage (file, page, &v9fs_req_ops,NULL ); +struct folio *folio =page_folio (page); + +return netfs_readpage (file, folio, &v9fs_req_ops,NULL ); }/**
@@ -132,13 +134,15 @@ static void v9fs_vfs_readahead(struct readahead_control *ractl)static int v9fs_release_page (struct page *page,gfp_t gfp) { -if (PagePrivate (page)) +struct folio *folio =page_folio (page); + +if (folio_test_private (folio))return 0 ;#ifdef CONFIG_9P_FSCACHE -if (PageFsCache (page)) { +if (folio_test_fscache (folio)) {if (!(gfp & __GFP_DIRECT_RECLAIM) || !(gfp & __GFP_FS))return 0 ; -wait_on_page_fscache (page); +folio_wait_fscache (folio); }#endif return 1 ;
@@ -154,55 +158,55 @@ static int v9fs_release_page(struct page *page, gfp_t gfp)static void v9fs_invalidate_page (struct page *page,unsigned int offset,unsigned int length) { -wait_on_page_fscache (page); +struct folio *folio =page_folio (page); + +folio_wait_fscache (folio); } -static int v9fs_vfs_writepage_locked (struct page *page) +static int v9fs_vfs_write_folio_locked (struct folio *folio) { -struct inode *inode = page->mapping->host; +struct inode *inode =folio_inode (folio);struct v9fs_inode *v9inode =V9FS_I (inode); -loff_t start =page_offset (page); +loff_t start =folio_pos (folio);loff_t size =i_size_read (inode);struct iov_iter from; -int err, len; +size_t gran =folio_size (folio), len; +int err; -if (page->index == size >>PAGE_SHIFT ) - len = size & ~PAGE_MASK ; -else - len =PAGE_SIZE ; + len = (size >= start + gran) ? gran : size - start; -iov_iter_xarray (&from,WRITE , &page->mapping->i_pages, start, len); +iov_iter_xarray (&from,WRITE , &folio_mapping (folio)->i_pages, start, len);/* We should have writeback_fid always set */ BUG_ON (!v9inode->writeback_fid); -set_page_writeback (page); +folio_start_writeback (folio);p9_client_write (v9inode->writeback_fid, start, &from, &err); -end_page_writeback (page); +folio_end_writeback (folio);return err; }static int v9fs_vfs_writepage (struct page *page,struct writeback_control *wbc) { +struct folio *folio =page_folio (page);int retval; -p9_debug (P9_DEBUG_VFS ,"page %p\n" , page); +p9_debug (P9_DEBUG_VFS ,"folio %p\n" , folio); - retval =v9fs_vfs_writepage_locked (page); + retval =v9fs_vfs_write_folio_locked (folio);if (retval <0 ) {if (retval == -EAGAIN ) { -redirty_page_for_writepage (wbc, page); +folio_redirty_for_writepage (wbc, folio); retval =0 ; }else { -SetPageError (page); -mapping_set_error (page->mapping, retval); +mapping_set_error (folio_mapping (folio), retval); } }else retval =0 ; -unlock_page (page); +folio_unlock (folio);return retval; }
@@ -215,14 +219,15 @@ static int v9fs_vfs_writepage(struct page *page, struct writeback_control *wbc)static int v9fs_launder_page (struct page *page) { +struct folio *folio =page_folio (page);int retval; -if (clear_page_dirty_for_io (page)) { - retval =v9fs_vfs_writepage_locked (page); +if (folio_clear_dirty_for_io (folio)) { + retval =v9fs_vfs_write_folio_locked (folio);if (retval)return retval; } -wait_on_page_fscache (page); +folio_wait_fscache (folio);return 0 ; }
@@ -265,10 +270,10 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)static int v9fs_write_begin (struct file *filp,struct address_space *mapping,loff_t pos,unsigned len,unsigned flags, -struct page **pagep,void **fsdata) +struct page **subpagep,void **fsdata) {int retval; -struct page *page; +struct folio *folio;struct v9fs_inode *v9inode =V9FS_I (mapping->host);p9_debug (P9_DEBUG_VFS ,"filp %p, mapping %p\n" , filp, mapping);
@@ -279,31 +284,32 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping,* file. We need to do this before we get a lock on the page in case * there's more than one writer competing for the same cache block. */ - retval =netfs_write_begin (filp, mapping, pos, len, flags, &page, fsdata, + retval =netfs_write_begin (filp, mapping, pos, len, flags, &folio, fsdata, &v9fs_req_ops,NULL );if (retval <0 )return retval; - *pagep =find_subpage (page, pos /PAGE_SIZE ); + *subpagep = &folio->page;return retval; }static int v9fs_write_end (struct file *filp,struct address_space *mapping,loff_t pos,unsigned len,unsigned copied, -struct page *page,void *fsdata) +struct page *subpage,void *fsdata) {loff_t last_pos = pos + copied; -struct inode *inode = page->mapping->host; +struct folio *folio =page_folio (subpage); +struct inode *inode = mapping->host;p9_debug (P9_DEBUG_VFS ,"filp %p, mapping %p\n" , filp, mapping); -if (!PageUptodate (page)) { +if (!folio_test_uptodate (folio)) {if (unlikely (copied < len)) { copied =0 ; goto out; } -SetPageUptodate (page); +folio_mark_uptodate (folio); }/*
@@ -314,10 +320,10 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,inode_add_bytes (inode, last_pos - inode->i_size);i_size_write (inode, last_pos); } -set_page_dirty (page); +folio_mark_dirty (folio); out: -unlock_page (page); -put_page (page); +folio_unlock (folio); +folio_put (folio);return copied; }
fs/9p/vfs_file.c +10 -10
@@ -529,13 +529,13 @@ static vm_fault_t v9fs_vm_page_mkwrite(struct vm_fault *vmf) {struct v9fs_inode *v9inode; -struct page *page = vmf->page; +struct folio *folio =page_folio (vmf->page);struct file *filp = vmf->vma->vm_file;struct inode *inode =file_inode (filp); -p9_debug (P9_DEBUG_VFS ,"page %p fid %lx\n" , - page, (unsigned long )filp->private_data); +p9_debug (P9_DEBUG_VFS ,"folio %p fid %lx\n" , + folio, (unsigned long )filp->private_data); v9inode =V9FS_I (inode);
@@ -543,24 +543,24 @@ v9fs_vm_page_mkwrite(struct vm_fault *vmf)* be modified. We then assume the entire page will need writing back. */ #ifdef CONFIG_9P_FSCACHE -if (PageFsCache (page) && -wait_on_page_fscache_killable (page) <0 ) -return VM_FAULT_RETRY ; +if (folio_test_fscache (folio) && +folio_wait_fscache_killable (folio) <0 ) +return VM_FAULT_NOPAGE ;#endif /* Update file times before taking page lock */ file_update_time (filp);BUG_ON (!v9inode->writeback_fid); -if (lock_page_killable (page) <0 ) +if (folio_lock_killable (folio) <0 )return VM_FAULT_RETRY ; -if (page->mapping != inode->i_mapping) +if (folio_mapping (folio) != inode->i_mapping) goto out_unlock; -wait_for_stable_page (page); +folio_wait_stable (folio);return VM_FAULT_LOCKED ; out_unlock: -unlock_page (page); +folio_unlock (folio);return VM_FAULT_NOPAGE ; }
fs/afs/file.c +38 -32
165 lines not on this page · raw message
fs/afs/internal.h +23 -23
82 lines not on this page · raw message
fs/afs/write.c +166 -180
652 lines not on this page · raw message
fs/ceph/addr.c +43 -37
183 lines not on this page · raw message
fs/netfs/read_helper.c +83 -82
367 lines not on this page · raw message
include/linux/netfs.h +6 -6
@@ -166,13 +166,13 @@ struct netfs_read_request {short error;/* 0 or error that occurred */ loff_t i_size;/* Size of the file */ loff_t start;/* Start position */ -pgoff_t no_unlock_page;/* Don't unlock this page after read */ +pgoff_t no_unlock_folio;/* Don't unlock this folio after read */ refcount_t usage;unsigned long flags;#define NETFS_RREQ_INCOMPLETE_IO 0/* Some ioreqs terminated short or with error */ #define NETFS_RREQ_WRITE_TO_CACHE 1/* Need to write to the cache */ -#define NETFS_RREQ_NO_UNLOCK_PAGE 2/* Don't unlock no_unlock_page on completion */ -#define NETFS_RREQ_DONT_UNLOCK_PAGES 3/* Don't unlock the pages on completion */ +#define NETFS_RREQ_NO_UNLOCK_FOLIO 2/* Don't unlock no_unlock_folio on completion */ +#define NETFS_RREQ_DONT_UNLOCK_FOLIOS 3/* Don't unlock the folios on completion */ #define NETFS_RREQ_FAILED 4/* The request failed */ #define NETFS_RREQ_IN_PROGRESS 5/* Unlocked when the request completes */ const struct netfs_read_request_ops *netfs_ops;
@@ -190,7 +190,7 @@ struct netfs_read_request_ops {void (*issue_op)(struct netfs_read_subrequest *subreq);bool (*is_still_valid)(struct netfs_read_request *rreq);int (*check_write_begin)(struct file *file,loff_t pos,unsigned len, -struct page *page,void **_fsdata); +struct folio *folio,void **_fsdata);void (*done)(struct netfs_read_request *rreq);void (*cleanup)(struct address_space *mapping,void *netfs_priv); };
@@ -240,11 +240,11 @@ extern void netfs_readahead(struct readahead_control *, const struct netfs_read_request_ops *, void *);extern int netfs_readpage (struct file *, -struct page *, +struct folio *,const struct netfs_read_request_ops *,void *);extern int netfs_write_begin (struct file *,struct address_space *, -loff_t ,unsigned int ,unsigned int ,struct page **, +loff_t ,unsigned int ,unsigned int ,struct folio **,void **,const struct netfs_read_request_ops *,void *);
include/trace/events/afs.h +11 -10
@@ -1016,31 +1016,32 @@ TRACE_EVENT(afs_dir_check_failed, __entry->vnode, __entry->off, __entry->i_size) ); -TRACE_EVENT (afs_page_dirty, - TP_PROTO(struct afs_vnode *vnode, const char *where, struct page *page), +TRACE_EVENT (afs_folio_dirty, + TP_PROTO(struct afs_vnode *vnode, const char *where, struct folio *folio), -TP_ARGS (vnode, where, page), +TP_ARGS (vnode, where, folio),TP_STRUCT__entry ( __field(struct afs_vnode *, vnode ) __field(const char *, where ) - __field(pgoff_t, page ) + __field(pgoff_t, index ) __field(unsigned long, from ) __field(unsigned long, to ) ),TP_fast_assign ( + unsigned long priv = (unsigned long)folio_get_private(folio); __entry->vnode = vnode; __entry->where = where; - __entry->page = page->index; - __entry->from = afs_page_dirty_from(page, page->private); - __entry->to = afs_page_dirty_to(page, page->private); - __entry->to |= (afs_is_page_dirty_mmapped (page->private) ? - (1UL << (BITS_PER_LONG - 1)) : 0); + __entry->index = folio_index(folio); + __entry->from = afs_folio_dirty_from(folio, priv); + __entry->to = afs_folio_dirty_to(folio, priv); + __entry->to |= (afs_is_folio_dirty_mmapped(priv) ? + (1UL << (BITS_PER_LONG - 1)) : 0); ),TP_printk ("vn=%p %lx %s %lx-%lx%s" , - __entry->vnode, __entry->page, __entry->where, + __entry->vnode, __entry->index, __entry->where, __entry->from, __entry->to & ~(1UL << (BITS_PER_LONG -1 )), __entry->to & (1UL << (BITS_PER_LONG - 1)) ? " M" : "")
Matthew Wilcox
maintainerRe: [PATCH v3 5/6] netfs, 9p, afs, ceph: Use folios
Quoted 9 lines · David Howells
fs/9p/vfs_addr.c +3
-3-static int v9fs_vfs_writepage_locked (struct page *page) +static int v9fs_vfs_write_folio_locked (struct folio *folio) { -struct inode *inode = page->mapping->host; +struct inode *inode =folio_inode (folio);struct v9fs_inode *v9inode =V9FS_I (inode); -loff_t start =page_offset (page); +loff_t start =folio_pos (folio);loff_t size =i_size_read (inode);
fs/9p/vfs_addr.c static int v9fs_release_page(struct page *page, gfp_t gfp) · line 176
Quoted 10 lines
fs/9p/vfs_addr.c +3
-5struct iov_iter from; -int err, len; +size_t gran =folio_size (folio), len; +int err; -if (page->index == size >>PAGE_SHIFT ) - len = size & ~PAGE_MASK ; -else - len =PAGE_SIZE ; + len = (size >= start + gran) ? gran : size - start;
This seems like the most complicated way to write this ... how about:
size_t len = min_t(loff_t, isize - start, folio_size(folio));
fs/afs/file.c static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · line 325
Quoted 6 lines
fs/afs/file.c +1
-1@@ -322,23 +322,24 @@ static void afs_req_issue_op(struct netfs_read_subrequest *subreq)static int afs_symlink_readpage (struct file *file,struct page *page) { -struct afs_vnode *vnode =AFS_FS_I (page->mapping->host); +struct afs_vnode *vnode =AFS_FS_I (page_mapping (page)->host);
How does swap end up calling readpage on a symlink?
fs/afs/file.c static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · line 342
Quoted 3 lines
fs/afs/file.c +1
-1ret =afs_fetch_data (fsreq->vnode, fsreq); -page_endio (page, false, ret); +page_endio (&folio->page, false, ret);
We need a folio_endio() ...
fs/afs/write.c int afs_write_begin(struct file *file, struct address_space *mapping, · line 115
Quoted 10 lines
fs/afs/write.c +3
-2int afs_write_end (struct file *file,struct address_space *mapping,loff_t pos,unsigned len,unsigned copied, -struct page *page,void *fsdata) +struct page *subpage,void *fsdata) { +struct folio *folio =page_folio (subpage);struct afs_vnode *vnode =AFS_FS_I (file_inode (file));unsigned long priv; -unsigned int f, from = pos & (thp_size (page) -1 ); +unsigned int f, from = pos & (folio_size (folio) -1 );
Isn't that:
size_t from = offset_in_folio(folio, pos);
(not that i think we're getting folios larger than 4GB any time soon, but it'd be nice to be prepared for it)
David Howells
maintainerRe: [PATCH v3 5/6] netfs, 9p, afs, ceph: Use folios
Quoted 5 lines · Matthew Wilcox
fs/9p/vfs_addr.c static int v9fs_release_page(struct page *page, gfp_t gfp) · line 176
Quoted 1 line
fs/9p/vfs_addr.c +1
-0+ len = (size >= start + gran) ? gran : size - start;This seems like the most complicated way to write this ... how about:
size_t len = min_t(loff_t, isize - start, folio_size(folio));
I was trying to hedge against isize-start going negative. Can this code race against truncate? truncate_setsize() changes i_size *before* invalidating the pages.
Quoted 6 lines
fs/afs/file.c static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · line 325
Quoted 4 lines
static int
afs_symlink_readpage(struct file *file, struct page *page){fs/afs/file.c +1
-1-struct afs_vnode *vnode =AFS_FS_I (page->mapping->host); +struct afs_vnode *vnode =AFS_FS_I (page_mapping (page)->host);How does swap end up calling readpage on a symlink?
Um - readpage is called to read the symlink.
Quoted 4 lines
fs/afs/file.c static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · line 342
Quoted 2 lines
fs/afs/file.c +1
-1-page_endio (page, false, ret); +page_endio (&folio->page, false, ret);We need a
folio_endio()...
I think we mentioned this before and I think you said you had or would make a patch for it. I can just create a wrapper for it if that'll do.
David
Matthew Wilcox
maintainerRe: [PATCH v3 5/6] netfs, 9p, afs, ceph: Use folios
Quoted 11 lines · David Howells
Quoted 5 lines · Matthew Wilcox
fs/9p/vfs_addr.c static int v9fs_release_page(struct page *page, gfp_t gfp) · line 176
Quoted 1 line
fs/9p/vfs_addr.c +1
-0+ len = (size >= start + gran) ? gran : size - start;This seems like the most complicated way to write this ... how about:
size_t len = min_t(loff_t, isize - start, folio_size(folio));I was trying to hedge against isize-start going negative. Can this code race against truncate?
truncate_setsize()changesi_size*before* invalidating the pages.
We should check for isize < start separately, and skip the writeback entirely.
Quoted 8 lines
Quoted 6 lines
fs/afs/file.c static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · line 325
Quoted 4 lines
static int
afs_symlink_readpage(struct file *file, struct page *page){fs/afs/file.c +1
-1-struct afs_vnode *vnode =AFS_FS_I (page->mapping->host); +struct afs_vnode *vnode =AFS_FS_I (page_mapping (page)->host);How does swap end up calling readpage on a symlink?
Um - readpage is called to read the symlink.
But the only reason to use page_mapping() instead of page->mapping is if you don't know that the page is in the page cache. You know that here, so I don't understand why you changed it.
Quoted 7 lines
Quoted 4 lines
fs/afs/file.c static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · line 342
Quoted 2 lines
fs/afs/file.c +1
-1-page_endio (page, false, ret); +page_endio (&folio->page, false, ret);We need a
folio_endio()...I think we mentioned this before and I think you said you had or would make a patch for it. I can just create a wrapper for it if that'll do.
Probably better to convert it and put a page_endio wrapper in folio-compat.c
David Howells
maintainerRe: [PATCH v3 5/6] netfs, 9p, afs, ceph: Use folios
Quoted 7 lines · Matthew Wilcox
Quoted 6 lines · David Howells
Quoted 4 lines · Matthew Wilcox
fs/9p/vfs_addr.c static int v9fs_release_page(struct page *page, gfp_t gfp) · line 176
Quoted 1 line
fs/9p/vfs_addr.c +1
-0+ len = (size >= start + gran) ? gran : size - start;This seems like the most complicated way to write this ... how about:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
size_t len = min_t(loff_t, isize - start, folio_size(folio));I was trying to hedge against isize-start going negative. Can this code race against truncate?
truncate_setsize()changesi_size*before* invalidating the pages.We should check for isize < start separately, and skip the writeback entirely.
So, something like the following
static int v9fs_vfs_write_folio_locked(struct folio *folio)
{
struct inode *inode = folio_inode(folio);
struct v9fs_inode *v9inode = V9FS_I(inode);
loff_t start = folio_pos(folio);
loff_t i_size = i_size_read(inode);
struct iov_iter from;
size_t len = folio_size(folio);
int err;
if (start >= i_size)
return 0; /* Simultaneous truncation occurred */
len = min_t(loff_t, i_size - start, len);
iov_iter_xarray(&from, ..., start, len);
...
}David
David Howells
maintainerPATCH 1/1 folio: Add replacements for page_endio()
In reply to Matthew WilcoxAdd three functions to replace page_endio():
(1) folio_end_read(). End a read to a folio.
(2) folio_end_write(). End a write from a folio.
(3) folio_endio(). A switcher that does one or the other of the above.
Change page_endio() to just call folio_endio(). Note that the parameter order is switched so that the folio_endio() stub doesn't have to shuffle the params around, but can rather just test and jump.
--- include/linux/pagemap.h | 9 ++++++ mm/filemap.c | 64 ++++++++++++++++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 22 deletions(-)
include/linux/pagemap.h +8 -1
@@ -845,7 +845,14 @@ static inline int __must_check write_one_page(struct page *page)int __set_page_dirty_nobuffers (struct page *page);int __set_page_dirty_no_writeback (struct page *page); -void page_endio (struct page *page,bool is_write,int err); +void folio_end_read (struct folio *folio,int err); +void folio_end_write (struct folio *folio,int err); +void folio_endio (struct folio *folio,int err,bool is_write); + +static inline void page_endio (struct page *page,bool is_write,int err) +{ +folio_endio (page_folio (page), err, is_write); +}void folio_end_private_2 (struct folio *folio);void folio_wait_private_2 (struct folio *folio);
mm/filemap.c +43 -21
76 lines not on this page · raw message
David Howells
maintainerPATCH v3 6/6 afs: Use folios in directory handling
In reply to David HowellsConvert the AFS directory handling code to use folios.
With these changes, afs passes -g quick xfstests.
---
fs/afs/dir.c | 229 ++++++++++++++++++++++------------------------------- fs/afs/dir_edit.c | 154 ++++++++++++++++++------------------ 2 files changed, 174 insertions(+), 209 deletions(-)
fs/afs/dir.c +95 -134
@@ -103,13 +103,13 @@ struct afs_lookup_cookie { };/* -* Drop the refs that we're holding on the pages we were reading into. We've +* Drop the refs that we're holding on the folios we were reading into. We've * got refs on the first nr_pages pages. */ static void afs_dir_read_cleanup (struct afs_read *req) {struct address_space *mapping = req->vnode->vfs_inode.i_mapping; -struct page *page; +struct folio *folio;pgoff_t last = req->nr_pages -1 ;XA_STATE (xas, &mapping->i_pages,0 );
@@ -118,65 +118,56 @@ static void afs_dir_read_cleanup(struct afs_read *req)return ;rcu_read_lock (); -xas_for_each (&xas, page, last) { -if (xas_retry (&xas, page)) +xas_for_each (&xas, folio, last) { +if (xas_retry (&xas, folio))continue ; -BUG_ON (xa_is_value (page)); -BUG_ON (PageCompound (page)); - ASSERTCMP(page->mapping, ==, mapping); +BUG_ON (xa_is_value (folio)); + ASSERTCMP(folio_file_mapping(folio), ==, mapping); -put_page (page); +folio_put (folio); }rcu_read_unlock (); }/* -* check that a directory page is valid +* check that a directory folio is valid */ -static bool afs_dir_check_page (struct afs_vnode *dvnode,struct page *page, -loff_t i_size) +static bool afs_dir_check_folio (struct afs_vnode *dvnode,struct folio *folio, +loff_t i_size) { -struct afs_xdr_dir_page *dbuf; -loff_t latter, off; -int tmp, qty; +union afs_xdr_dir_block *block; +size_t offset, size; +loff_t pos; -/* Determine how many magic numbers there should be in this page, but +/* Determine how many magic numbers there should be in this folio, but * we must take care because the directory may change size under us. */ - off =page_offset (page); -if (i_size <= off) + pos =folio_pos (folio); +if (i_size <= pos) goto checked; - latter = i_size - off; -if (latter >=PAGE_SIZE ) - qty =PAGE_SIZE ; -else - qty = latter; - qty /=sizeof (union afs_xdr_dir_block ); - -/* check them */ - dbuf =kmap_atomic (page); -for (tmp =0 ; tmp < qty; tmp++) { -if (dbuf->blocks[tmp].hdr.magic !=AFS_DIR_MAGIC ) { -printk ("kAFS: %s(%lx): bad magic %d/%d is %04hx\n" , - __func__, dvnode->vfs_inode.i_ino, tmp, qty, -ntohs (dbuf->blocks[tmp].hdr.magic)); -trace_afs_dir_check_failed (dvnode, off, i_size); -kunmap (page); + size =min_t (loff_t,folio_size (folio), i_size - pos); +for (offset =0 ; offset < size; offset +=sizeof (*block)) { + block =kmap_local_folio (folio, offset); +if (block->hdr.magic !=AFS_DIR_MAGIC ) { +printk ("kAFS: %s(%lx): [%llx] bad magic %zx/%zx is %04hx\n" , + __func__, dvnode->vfs_inode.i_ino, + pos, offset, size,ntohs (block->hdr.magic)); +trace_afs_dir_check_failed (dvnode, pos + offset, i_size); +kunmap_local (block);trace_afs_file_error (dvnode, -EIO , afs_file_error_dir_bad_magic); goto error; }/* Make sure each block is NUL terminated so we can reasonably -* use string functions on it. The filenames in the page +* use string functions on it. The filenames in the folio * *should* be NUL-terminated anyway. */ - ((u8 *)&dbuf->blocks[tmp])[AFS_DIR_BLOCK_SIZE -1 ] =0 ; - } - -kunmap_atomic (dbuf); + ((u8 *)block)[AFS_DIR_BLOCK_SIZE -1 ] =0 ; +kunmap_local (block); + } checked:afs_stat_v (dvnode, n_read_dir);return true;
@@ -190,11 +181,11 @@ static bool afs_dir_check_page(struct afs_vnode *dvnode, struct page *page,*/ static void afs_dir_dump (struct afs_vnode *dvnode,struct afs_read *req) { -struct afs_xdr_dir_page *dbuf; +union afs_xdr_dir_block *block;struct address_space *mapping = dvnode->vfs_inode.i_mapping; -struct page *page; -unsigned int i, qty =PAGE_SIZE /sizeof (union afs_xdr_dir_block ); +struct folio *folio;pgoff_t last = req->nr_pages -1 ; +size_t offset, size;XA_STATE (xas, &mapping->i_pages,0 );
@@ -205,30 +196,28 @@ static void afs_dir_dump(struct afs_vnode *dvnode, struct afs_read *req) req->pos, req->nr_pages, req->iter->iov_offset, iov_iter_count(req->iter)); -xas_for_each (&xas, page, last) { -if (xas_retry (&xas, page)) +xas_for_each (&xas, folio, last) { +if (xas_retry (&xas, folio))continue ; -BUG_ON (PageCompound (page)); -BUG_ON (page->mapping != mapping); - - dbuf =kmap_atomic (page); -for (i =0 ; i < qty; i++) { -union afs_xdr_dir_block *block = &dbuf->blocks[i]; +BUG_ON (folio_file_mapping (folio) != mapping); -pr_warn ("[%02lx] %32phN\n" , page->index * qty + i, block); + size =min_t (loff_t,folio_size (folio), req->actual_len -folio_pos (folio)); +for (offset =0 ; offset < size; offset +=sizeof (*block)) { + block =kmap_local_folio (folio, offset); +pr_warn ("[%02lx] %32phN\n" ,folio_index (folio) + offset, block); +kunmap_local (block); } -kunmap_atomic (dbuf); } }/* -* Check all the pages in a directory. All the pages are held pinned. +* Check all the blocks in a directory. All the folios are held pinned. */ static int afs_dir_check (struct afs_vnode *dvnode,struct afs_read *req) {struct address_space *mapping = dvnode->vfs_inode.i_mapping; -struct page *page; +struct folio *folio;pgoff_t last = req->nr_pages -1 ;int ret =0 ;
@@ -238,14 +227,13 @@ static int afs_dir_check(struct afs_vnode *dvnode, struct afs_read *req)return 0 ;rcu_read_lock (); -xas_for_each (&xas, page, last) { -if (xas_retry (&xas, page)) +xas_for_each (&xas, folio, last) { +if (xas_retry (&xas, folio))continue ; -BUG_ON (PageCompound (page)); -BUG_ON (page->mapping != mapping); +BUG_ON (folio_file_mapping (folio) != mapping); -if (!afs_dir_check_page (dvnode, page, req->file_size)) { +if (!afs_dir_check_folio (dvnode, folio, req->actual_len)) {afs_dir_dump (dvnode, req); ret = -EIO ;break ;
@@ -274,15 +262,16 @@ static int afs_dir_open(struct inode *inode, struct file *file)/* * Read the directory into the pagecache in one go, scrubbing the previous -* contents. The list of pages is returned, pinning them so that they don't +* contents. The list of folios is returned, pinning them so that they don't * get reclaimed during the iteration. */ static struct afs_read *afs_read_dir (struct afs_vnode *dvnode,struct key *key) __acquires(&dvnode->validate_lock) { +struct address_space *mapping = dvnode->vfs_inode.i_mapping;struct afs_read *req;loff_t i_size; -int nr_pages, i, n; +int nr_pages, i;int ret;_enter ("" );
@@ -320,43 +309,30 @@ static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key *key) req->iter = &req->def_iter;/* Fill in any gaps that we might find where the memory reclaimer has -* been at work and pin all the pages. If there are any gaps, we will +* been at work and pin all the folios. If there are any gaps, we will * need to reread the entire directory contents. */ i = req->nr_pages;while (i < nr_pages) { -struct page *pages[8 ], *page; - - n =find_get_pages_contig (dvnode->vfs_inode.i_mapping, i, - min_t(unsigned int, nr_pages - i, -ARRAY_SIZE (pages)), - pages); -_debug ("find %u at %u/%u" , n, i, nr_pages); - -if (n ==0 ) { -gfp_t gfp = dvnode->vfs_inode.i_mapping->gfp_mask; +struct folio *folio; + folio =filemap_get_folio (mapping, i); +if (!folio) {if (test_and_clear_bit (AFS_VNODE_DIR_VALID , &dvnode->flags))afs_stat_v (dvnode, n_inval); ret = -ENOMEM ; - page =__page_cache_alloc (gfp); -if (!page) + folio =__filemap_get_folio (mapping, + i,FGP_LOCK |FGP_CREAT , + mapping->gfp_mask); +if (!folio) goto error; - ret =add_to_page_cache_lru (page, - dvnode->vfs_inode.i_mapping, - i, gfp); -if (ret <0 ) - goto error; - -attach_page_private (page, (void *)1 ); -unlock_page (page); - req->nr_pages++; - i++; - }else { - req->nr_pages += n; - i += n; +folio_attach_private (folio, (void *)1 ); +folio_unlock (folio); } + + req->nr_pages +=folio_nr_pages (folio); + i +=folio_nr_pages (folio); }/* If we're going to reload, we need to lock all the pages to prevent
@@ -424,7 +400,7 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode,size_t nlen;int tmp; -_enter ("%u,%x,%p,," ,(unsigned )ctx->pos,blkoff,block); +_enter ("%llx,%x" , ctx->pos, blkoff); curr = (ctx->pos - blkoff) /sizeof (union afs_xdr_dirent );
@@ -513,12 +489,10 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx, struct key *key, afs_dataversion_t *_dir_version) { struct afs_vnode *dvnode = AFS_FS_I(dir); -struct afs_xdr_dir_page *dbuf;union afs_xdr_dir_block *dblock;struct afs_read *req; -struct page *page; -unsigned blkoff, limit; -void __rcu **slot; +struct folio *folio; +unsigned offset, size;int ret;_enter ("{%lu},%u,," , dir->i_ino, (unsigned )ctx->pos);
@@ -540,43 +514,30 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx,/* walk through the blocks in sequence */ ret =0 ;while (ctx->pos < req->actual_len) { - blkoff = ctx->pos & ~(sizeof (union afs_xdr_dir_block ) -1 ); - -/* Fetch the appropriate page from the directory and re-add it +/* Fetch the appropriate folio from the directory and re-add it * to the LRU. We have all the pages pinned with an extra ref. */ -rcu_read_lock (); - page =NULL ; - slot =radix_tree_lookup_slot (&dvnode->vfs_inode.i_mapping->i_pages, - blkoff /PAGE_SIZE ); -if (slot) - page =radix_tree_deref_slot (slot); -rcu_read_unlock (); -if (!page) { + folio =__filemap_get_folio (dir->i_mapping, ctx->pos /PAGE_SIZE , +FGP_ACCESSED ,0 ); +if (!folio) { ret =afs_bad (dvnode, afs_file_error_dir_missing_page);break ; } -mark_page_accessed (page); - limit = blkoff & ~(PAGE_SIZE -1 ); + offset =round_down (ctx->pos,sizeof (*dblock)) -folio_file_pos (folio); + size =min_t (loff_t,folio_size (folio), + req->actual_len -folio_file_pos (folio)); - dbuf =kmap (page); - -/* deal with the individual blocks stashed on this page */ do { - dblock = &dbuf->blocks[(blkoff %PAGE_SIZE ) / -sizeof (union afs_xdr_dir_block )]; - ret =afs_dir_iterate_block (dvnode, ctx, dblock, blkoff); -if (ret !=1 ) { -kunmap (page); + dblock =kmap_local_folio (folio, offset); + ret =afs_dir_iterate_block (dvnode, ctx, dblock, +folio_file_pos (folio) + offset); +kunmap_local (dblock); +if (ret !=1 ) goto out; - } - blkoff +=sizeof (union afs_xdr_dir_block ); + }while (offset +=sizeof (*dblock), offset < size); - }while (ctx->pos < dir->i_size && blkoff < limit); - -kunmap (page); ret =0 ; }
@@ -2037,42 +1998,42 @@ static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, }/* -* Release a directory page and clean up its private state if it's not busy -* - return true if the page can now be released, false if not +* Release a directory folio and clean up its private state if it's not busy +* - return true if the folio can now be released, false if not */ -static int afs_dir_releasepage (struct page *page,gfp_t gfp_flags) +static int afs_dir_releasepage (struct page *subpage,gfp_t gfp_flags) { -struct afs_vnode *dvnode =AFS_FS_I (page->mapping->host); +struct folio *folio =page_folio (subpage); +struct afs_vnode *dvnode =AFS_FS_I (folio_inode (folio)); -_enter ("{{%llx:%llu}[%lu]}" , dvnode->fid.vid, dvnode->fid.vnode, page->index); +_enter ("{{%llx:%llu}[%lu]}" , dvnode->fid.vid, dvnode->fid.vnode,folio_index (folio)); -detach_page_private (page); +folio_detach_private (folio);/* The directory will need reloading. */ if (test_and_clear_bit (AFS_VNODE_DIR_VALID , &dvnode->flags))afs_stat_v (dvnode, n_relpg); -return 1 ; +return true; }/* -* invalidate part or all of a page -* - release a page and clean up its private data if offset is 0 (indicating -* the entire page) +* Invalidate part or all of a folio. */ -static void afs_dir_invalidatepage (struct page *page,unsigned int offset, +static void afs_dir_invalidatepage (struct page *subpage,unsigned int offset,unsigned int length) { -struct afs_vnode *dvnode =AFS_FS_I (page->mapping->host); +struct folio *folio =page_folio (subpage); +struct afs_vnode *dvnode =AFS_FS_I (folio_inode (folio)); -_enter ("{%lu},%u,%u" , page->index, offset, length); +_enter ("{%lu},%u,%u" ,folio_index (folio), offset, length); -BUG_ON (!PageLocked (page)); +BUG_ON (!folio_test_locked (folio));/* The directory will need reloading. */ if (test_and_clear_bit (AFS_VNODE_DIR_VALID , &dvnode->flags))afs_stat_v (dvnode, n_inval); -/* we clean up only if the entire page is being invalidated */ -if (offset ==0 && length ==thp_size (page)) -detach_page_private (page); +/* we clean up only if the entire folio is being invalidated */ +if (offset ==0 && length ==folio_size (folio)) +folio_detach_private (folio); }
fs/afs/dir_edit.c +79 -75
291 lines not on this page · raw message