Re: [PATCH 2/2] ext4: add ioctl EXT4_FLUSH_JOURNAL
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-03-30 17:19:41
On Tue, Mar 30, 2021 at 01:15:08PM -0400, Theodore Ts'o wrote:
On Tue, Mar 30, 2021 at 09:32:23AM -0700, Darrick J. Wong wrote:quoted
Why not make discarding the journal part of FITRIM then?Unfortunately, the fstrim_range structure doesn't have a place for a flags field, and FITRIM works by specifying a range of LBA's: struct fstrim_range { __u64 start; __u64 len; __u64 minlen; }; I suppose we could do something where some combination of start/len means "also checkpoint and discard the journal", but that seems rather kludgy.quoted
It occurred to me overnight that another way to look at this ioctl proposal is that it checkpoints the filesystem and has a flag to discard the journal blocks too. Given that we're now only two days away from my traditional bootfs[1] drum-banging day, and there's real user demand[2] for bootloaders to be able to force a journal checkpoint,How about if we have an ioctl which is "checkpoint journal", which can be file system independent (e.g., defined in include/uapi/linux/fs.h) which takes a u32 flags field, where we define a flag bit to mean "also discard the unused part of the journal after the checkpoint"? It seems that would also solve your bootfs() use case.
Yeah, that's where I was going with this. I just sent a new review for the other patch with that level of focus. :) --D
- Ted