Bug 512171

Summary: [RFE] GFS2: Make use of I/O alignment info (2.6.31+) to set default block size/alignment in mkfs.gfs2
Product: [Fedora] Fedora Reporter: Steve Whitehouse <swhiteho>
Component: gfs2-utilsAssignee: Robert Peterson <rpeterso>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: adas, agk, bmarzins, cfeist, fdinitto, kzak, msnitzer, rwheeler, swhiteho
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-02 15:06:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 519491, 569845, 894348    

Description Steve Whitehouse 2009-07-16 15:49:17 UTC
Shouldn't be too tricky - the info is available via sysfs, so we can just set defaults from it if the sysfs files exist for the particular device in question.

Comment 1 Alasdair Kergon 2009-08-27 09:00:54 UTC
Chat to Mike Snitzer who's recently been dealing with this in lvm2 and device-mapper.

Comment 2 Mike Snitzer 2009-08-27 15:39:15 UTC
Please have a look at the latest Linux 2.6.31+ Documentation/ABI/testing/sysfs-block

It contains information about the sysfs interfaces that have been exposed.

Aside from the raw sysfs interfaces there has been progress in the upstream util-linux-ng project to have its libblkid provide a programmatic API to access the I/O topology information.  libblkid simply pulls the information out of sysfs; but it _should_ also abstract the nuance of getting the proper 'alignment_offset' depending on whether a device is a partition or not.  Similarly it needs to (and should already) know that the other sysfs values for a partition (e.g. logical_block_size, minimum_io_size, etc) reside in the parent device's queue/ directory.

Christoph Hellwig derived his preliminary patch to support I/O topology support in libblkid from LVM2's code (code which I wrote):
http://article.gmane.org/gmane.linux.utilities.util-linux-ng/2471

Karel Zak later took Christoph's preliminary util-linux-ng patch and refactored it to be more in-keeping with the nature of the libblkid API:
http://article.gmane.org/gmane.linux.utilities.util-linux-ng/2489

But I'm not yet seeing the I/O topology code in upstream's util-linux-ng git repo.  Cc'ing Karel Zak for more info.

Comment 3 Karel Zak 2009-08-28 18:44:58 UTC
(In reply to comment #2) 
> But I'm not yet seeing the I/O topology code in upstream's util-linux-ng git
> repo.  Cc'ing Karel Zak for more info.  

The code is in the topic/libblkid-2.17 branch (upstream repo). For more details about API see the samples/ directory, for example:

http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob;f=shlibs/blkid/samples/topology.c;hb=topic/libblkid-2.17

http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob;f=shlibs/blkid/samples/mkfs.c;hb=topic/libblkid-2.17

I'd like to release something useful (= 2.17-rc1) in September.

Comment 4 Steve Whitehouse 2009-09-23 15:52:56 UTC
There might be an ioctl() interface as well, as per this email, still pending review upstream:

Delivery-date: Wed, 23 Sep 2009 14:21:56 +0100
To: linux-fsdevel.org
Cc: Eric Sandeen <sandeen>, Andreas Dilger <adilger>,
        Jim Meyering <jim>, jens.axboe
Subject: Topology ioctls
From: "Martin K. Petersen" <martin.petersen>

Comment 5 Mike Snitzer 2010-02-25 16:32:58 UTC
(In reply to comment #4)
> There might be an ioctl() interface as well, as per this email, still pending
> review upstream:

Yes the ioctl() interface is now upstream, see:
http://git.kernel.org/linus/ac481c20ef8f6c6

In summary:
BLKALIGNOFF: alignment_offset
BLKPBSZGET: physical_block_size
BLKSSZGET: logical_block_size
BLKIOMIN: minimum_io_size
BLKIOOPT: optimal_io_size

Comment 6 Robert Peterson 2010-03-02 15:06:38 UTC
I pushed a patch to the STABLE3 branch of the cluster git tree
that does some of this work, and that is built into rawhide as
of today.  I will be opening another bug to do more follow-on
work for making gfs2 work with raid stripe information and such.