On Wed, Mar 05, 2025 at 09:04:50AM -0800, Luis Chamberlain wrote: > On Wed, Mar 05, 2025 at 02:15:47PM +0000, Matthew Wilcox wrote: > > On Tue, Mar 04, 2025 at 10:33:30PM -0800, Darrick J. Wong wrote: > > > > So this is expedient because XFS happens to not call sb_set_blocksize()? > > > > What is the path forward for filesystems which call sb_set_blocksize() > > > > today and want to support LBS in future? > > > > > > Well they /could/ set sb_blocksize/sb_blocksize_bits themselves, like > > > XFS does. > > > > I'm kind of hoping that isn't the answer. > > set_blocksize() can be used. The only extra steps the filesystem needs > to in addition is: > > sb->s_blocksize = size; > sb->s_blocksize_bits = blksize_bits(size); > > Which is what both XFS and bcachefs do. > > We could modify sb to add an LBS flag but that alone would not suffice > either as the upper limit is still a filesystem specific limit. Additionally > it also does not suffice for filesystems that support a different device > for metadata writes, for instance XFS supports this and uses the sector > size for set_blocksize(). > > So I think that if ext4 for example wants to use LBS then simply it > would open code the above two lines and use set_blocksize(). Let me know > if you have any other recommendations. int sb_set_large_blocksize(struct super_block *sb, int size) { if (set_blocksize(sb->s_bdev_file, size)) return 0; sb->s_blocksize = size; sb->s_blocksize_bits = blksize_bits(size); return sb->s_blocksize; } EXPORT_SYMBOL_GPL(sb_set_large_blocksize); int sb_set_blocksize(struct super_block *sb, int size) { if (size > PAGE_SIZE) return 0; return sb_set_large_blocksize(sb, size); } EXPORT_SYMBOL(sb_set_blocksize); Though you'll note that this doesn't help XFS, or any other filesystem where the bdev block size isn't set to the fs block size. But xfs can just be weird on its own like always. ;) --D > > Luis