Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=85821484...
Commit: 85821484421fde65b127eef81eea71a6e719b892
Parent: 7e55c059388c25cd6e3c22e1c6ac9af5519f1dc3
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Jan 26 11:05:42 2017 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Thu Jan 26 15:29:45 2017 +0000
mkfs.gfs2: Disable rgrp alignment when dev topology is unsuitable
If optimal_io_size is not a multiple of minimum_io_size then the values
are not reliable swidth and sunit values, so disable rgrp stripe
alignment in that case.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/mkfs/main_mkfs.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index db83d1c..e2c4a22 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -629,8 +629,14 @@ static lgfs2_rgrps_t rgs_init(struct mkfs_opts *opts, struct gfs2_sbd
*sdp)
al_off = opts->sunit / sdp->bsize;
}
} else if (opts->align) {
- if ((opts->dev.minimum_io_size > opts->dev.physical_sector_size) &&
- (opts->dev.optimal_io_size > opts->dev.physical_sector_size)) {
+ if (opts->dev.optimal_io_size <= opts->dev.physical_sector_size ||
+ opts->dev.minimum_io_size <= opts->dev.physical_sector_size ||
+ (opts->dev.optimal_io_size % opts->dev.minimum_io_size) != 0) {
+ /* If optimal_io_size is not a multiple of minimum_io_size then
+ the values are not reliable swidth and sunit values, so disable
+ rgrp alignment */
+ opts->align = 0;
+ } else {
al_base = opts->dev.optimal_io_size / sdp->bsize;
al_off = opts->dev.minimum_io_size / sdp->bsize;
}