Re: [PATCH 12/41] fs: Drop sync_mapping_buffers() from __generic_file_fsync()

Jan Kara <[email protected]> Tue, 24 Mar 2026 13:34:57 +0100
Newsgroups gmane.linux.kernel.aio.general,gmane.linux.file-systems,gmane.linux.block,gmane.comp.file-systems.ext4,gmane.linux.kernel.mm
Message-ID <ezdm6d34jqdrcohk7o6wycxvvlgtf6aqenwx5ffr3plfagdbzi@gibz7xwr6yhr>
On Mon 23-03-26 22:40:21, Christoph Hellwig wrote:
> On Fri, Mar 20, 2026 at 02:41:07PM +0100, Jan Kara wrote:
> > No filesystem calling __generic_file_fsync() uses metadata bh tracking.
> > Drop sync_mapping_buffers() call from __generic_file_fsync() as it's
> > pointless now.
> 
> Given how much this changed, maybe rename it to simple_fsync now to
> provide an obvious breakage for anyone trying to use it?  That name
> is probably also better as it's not all that generic.

I'm fine with simple_fsync() name for the helper with the trivial behavior
of writing out the mapping and the inode. Code wise this will look somewhat
different given what you've suggested for the last patch.

								Honza

> 
> > 
> > Signed-off-by: Jan Kara <[email protected]>
> > ---
> >  fs/libfs.c | 8 ++------
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/libfs.c b/fs/libfs.c
> > index 74134ba2e8d1..548e119668df 100644
> > --- a/fs/libfs.c
> > +++ b/fs/libfs.c
> > @@ -1555,23 +1555,19 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end,
> >  {
> >  	struct inode *inode = file->f_mapping->host;
> >  	int err;
> > -	int ret;
> > +	int ret = 0;
> >  
> >  	err = file_write_and_wait_range(file, start, end);
> >  	if (err)
> >  		return err;
> >  
> >  	inode_lock(inode);
> > -	ret = sync_mapping_buffers(inode->i_mapping);
> >  	if (!(inode_state_read_once(inode) & I_DIRTY_ALL))
> >  		goto out;
> >  	if (datasync && !(inode_state_read_once(inode) & I_DIRTY_DATASYNC))
> >  		goto out;
> >  
> > -	err = sync_inode_metadata(inode, 1);
> > -	if (ret == 0)
> > -		ret = err;
> > -
> > +	ret = sync_inode_metadata(inode, 1);
> >  out:
> >  	inode_unlock(inode);
> >  	/* check and advance again to catch errors after syncing out buffers */
> > -- 
> > 2.51.0
> > 
> > 
> ---end quoted text---
-- 
Jan Kara <[email protected]>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to [email protected].  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"[email protected]">[email protected]</a>