Steve French <smfrench@xxxxxxxxx> wrote: > WARNING: Missing a blank line after declarations > #460: FILE: fs/cifs/file.c:658: > + struct cifs_fscache_inode_coherency_data cd; > + cifs_fscache_fill_coherency(file_inode(file), &cd); I have a small patch to abstract cache invalidation for cifs into a helper function (see attached) that I'll merge in that will also take care of this. David --- commit ff463eee039fbe119ae0d4185cb8a90aec10ec80 Author: David Howells <dhowells@xxxxxxxxxx> Date: Fri Jan 7 18:08:37 2022 +0000 cifs: Abstract cache invalidation into a helper function Abstract fscache invalidation for a cifs inode out into a helper function as there will be more than one caller of it. Signed-off-by: David Howells <dhowells@xxxxxxxxxx> diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 27604eb01a94..015fd415e5ee 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -653,13 +653,9 @@ int cifs_open(struct inode *inode, struct file *file) file->f_mode & FMODE_WRITE); if (file->f_flags & O_DIRECT && (!((file->f_flags & O_ACCMODE) != O_RDONLY) || - file->f_flags & O_APPEND)) { - struct cifs_fscache_inode_coherency_data cd; - cifs_fscache_fill_coherency(file_inode(file), &cd); - fscache_invalidate(cifs_inode_cookie(file_inode(file)), - &cd, i_size_read(file_inode(file)), - FSCACHE_INVAL_DIO_WRITE); - } + file->f_flags & O_APPEND)) + cifs_invalidate_cache(file_inode(file), + FSCACHE_INVAL_DIO_WRITE); out: free_dentry_path(page); diff --git a/fs/cifs/fscache.h b/fs/cifs/fscache.h index e444445d0906..b741d38df6c8 100644 --- a/fs/cifs/fscache.h +++ b/fs/cifs/fscache.h @@ -71,6 +71,15 @@ static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode) return netfs_i_cookie(inode); } +static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags) +{ + struct cifs_fscache_inode_coherency_data cd; + + cifs_fscache_fill_coherency(inode, &cd); + fscache_invalidate(cifs_inode_cookie(inode), &cd, + i_size_read(inode), flags); +} + static inline int cifs_readpage_from_fscache(struct inode *inode, struct page *page) { @@ -112,6 +121,7 @@ static inline void cifs_fscache_get_inode_cookie(struct inode *inode) {} static inline void cifs_fscache_release_inode_cookie(struct inode *inode) {} static inline void cifs_fscache_unuse_inode_cookie(struct inode *inode, bool update) {} static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode) { return NULL; } +static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags) {} static inline int cifs_readpage_from_fscache(struct inode *inode, struct page *page)