Re: [PATCH v9 05/15] xfs: ignore HW which cannot atomic write a single block
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2025-05-01 19:53:49
Also in:
linux-block, linux-ext4, linux-fsdevel, linux-xfs, lkml
On Thu, May 01, 2025 at 09:22:16AM -0700, Darrick J. Wong wrote:
On Wed, Apr 30, 2025 at 02:59:06PM +0200, Christoph Hellwig wrote:quoted
On Tue, Apr 29, 2025 at 07:44:46AM -0700, Darrick J. Wong wrote:quoted
quoted
So this can't be merged into xfs_setsize_buftarg as suggeted last round instead of needing yet another per-device call into the buftarg code?Oh, heh, I forgot that xfs_setsize_buftarg is called a second time by xfs_setup_devices at the end of fill_super.That's actually the real call. The first is just a dummy to have bt_meta_sectorsize/bt_meta_sectormask initialized because if we didn't do that some assert in the block layer triggered. We should probably remove that call and open code the two assignments..quoted
I don't like the idea of merging the hw atomic write detection into xfs_setsize_buftarg itself because (a) it gets called for the data device before we've read the fs blocksize so the validation is meaningless and (b) that makes xfs_setsize_buftarg's purpose less cohesive.As explained last round this came up I'd of course rename it if we did that. But I can do that later.<nod> Would you be willing to review this patch as it is now and either you or me can just tack a new cleanup patch on the end? I tried writing a patch to clean this up, but ran into questions: At first I thought that the xfs_setsize_buftarg call in xfs_alloc_buftarg could be replaced by open-coding the bt_meta_sector* assignment, checking that bdev_validate_blocksize is ok, and dropping the sync_blockdev. Once we get to xfs_setup_devices, we can call xfs_setsize_buftarg on the three buftargs, and xfs_setsize_buftarg will configure the atomic writes geometry. But then as I was reading the patch, it occurred to me that at least for the data device, we actually /do/ want that sync_blockdev call so that any dirty pagecache for the superblock actually get written to disk. Maybe that can go at the end of xfs_open_devices? But would it be preferable to sync all the devices prior to trying to read the primary sb? I don't think there's a need, but maybe someone else has a different viewpoint?
Eh, since John posted a V10 I'll just tack my new patches on the end of that so everyone can look at them. --D