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

Christoph Hellwig <[email protected]> Tue, 24 Mar 2026 06:17:16 -0700
Newsgroups gmane.linux.kernel.aio.general,gmane.linux.file-systems,gmane.linux.block,gmane.comp.file-systems.ext4,gmane.linux.kernel.mm
Message-ID <[email protected]>
On Tue, Mar 24, 2026 at 01:34:57PM +0100, Jan Kara wrote:
> 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.

Yeah, the pitfalls of going sequentially through the series :)

But sketching this out I'm not even sure all this makes sense any more.
Maybe instad of the allback we should just have a helper for checking the
inode state like:

static inline bool inode_need_fsync(struct inode *inode, bool datasync)
{
	enum inode_state_flags_enum state = inode_state_read_once(inode);

	if (!(state & I_DIRTY_ALL))
                return false;
        if (datasync && !(state & I_DIRTY_DATASYNC))
                retun false;
	return true;
}

and otherwise just open code the calls int the two implementations
without any callbacks, as it feels cleaner to avoid the entanglement.

This helper might also be useful for other fs-specific implementations
later on.


--
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>