From: Andrew Price Date: Wed, 27 May 2020 11:02:34 +0100 Subject: [Cluster-devel] [PATCH] mkfs.gfs2: Don't use optimal_io_size when equal to minimum In-Reply-To: <38694c56-7dcb-a52e-2d12-01949c20b9bd@redhat.com> References: <20200527082954.1235228-1-anprice@redhat.com> <38694c56-7dcb-a52e-2d12-01949c20b9bd@redhat.com> Message-ID: <535f4043-d004-c7cd-be3a-0621fd2a35ba@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 27/05/2020 09:53, Steven Whitehouse wrote: > Hi, > > On 27/05/2020 09:29, Andrew Price wrote: >> Some devices report an optimal_io_size of 512 instead of 0 when it's not >> larger than the minimum_io_size. Currently mkfs.gfs2 uses the non-zero >> value to choose the block size, which is almost certainly not what we >> want when it's 512. Update the suitability check for optimal_io_size to >> avoid using it when it's the same as minimum_io_size.? The effect is >> that we fall back to using the default block size, 4096. >> >> Resolves: rhbz#1839219 >> Signed-off-by: Andrew Price > > What about for other sizes? We don't really want to select a block size > to be anything other than 4k in most cases, even if the block device > offers a lower minimum/optimal I/O size, I think it would be unusual for a device to have an optimal_io_size > 512 and < 4K, and I expect it's only 512 for the tested device because of some design or configuration error, so we're still covering most cases anyway. I figured that any other optimal_io_size is likely to be one that's there for a good reason and so we should probably use it (if suitable). That's just my reasoning for this patch though. I can see the value in ignoring optimal_io_size < 4K, but it poses the question of whether there's any value in allowing mkfs.gfs2 to create < 4K block size filesystems@all. Andy > >> --- >> ? gfs2/mkfs/main_mkfs.c | 2 +- >> ? 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c >> index 846b341f..8b97f3d2 100644 >> --- a/gfs2/mkfs/main_mkfs.c >> +++ b/gfs2/mkfs/main_mkfs.c >> @@ -505,7 +505,7 @@ static unsigned choose_blocksize(struct mkfs_opts >> *opts) >> ????? } >> ????? if (!opts->got_bsize && got_topol) { >> ????????? if (dev->optimal_io_size <= getpagesize() && >> -??????????? dev->optimal_io_size >= dev->minimum_io_size) >> +??????????? dev->optimal_io_size > dev->minimum_io_size) >> ????????????? bsize = dev->optimal_io_size; >> ????????? else if (dev->physical_sector_size <= getpagesize() && >> ?????????????????? dev->physical_sector_size >= GFS2_DEFAULT_BSIZE)