On Wed, Jul 03, 2024 at 06:29:22AM +0200, Christoph Hellwig wrote: > On Tue, Jul 02, 2024 at 07:29:14PM -0700, Darrick J. Wong wrote: > > Oooh, that's a good idea. Let me fiddle with that & tack it on the end? > > > > Hmm. How do we query the discard granularity from a userspace program? > > I can try to guess the /sys/block/XXX root from the devices passed in, > > or maybe libblkid will tell me? And then I'd have to go open > > queue/discard_granularity underneath that to read that. > > Good question. As far as I can tell there is no simply ioctl for it. > I really wonder if we need an extensible block topology ioctl that we > can keep adding files for new queue limits, to make it easy to query > them from userspace without all that sysfs mess.. Yeah. Or implement FS_IOC_GETSYSFSPATH for block devices? :P > > That's going to take a day or so, I suspect. :/ > > No rush, just noticed it. Note that for the discard granularity > we should also look at the alignment and not just the size. <nod> AFAICT the xfs discard code doesn't check the alignment. Maybe the block layer does, but ... weirdly we've now refactored xfs_discard_extents so that it /never/ reports errors of any kind in the submit loop because __blkdev_issue_discard always returns 0, and the endio doesn't check the bio status either. --D