aboutsummaryrefslogtreecommitdiff
path: root/misc/mke2fs.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2010-11-22 10:50:42 -0500
committerTheodore Ts'o <tytso@mit.edu>2010-11-22 10:50:42 -0500
commit1599b470fb881313c1d44594f05d578c43825312 (patch)
treeb0d17e7e100adfce7705b3c9acc21020c1ec9694 /misc/mke2fs.c
parentf89f54aff479af859ee483c907041bcc9c0698f8 (diff)
downloade2fsprogs-1599b470fb881313c1d44594f05d578c43825312.tar.gz
mke2fs: Fill in min_io and opt_io with physical sector size
If the device does not have an explicitly specified minimum io_size or optimal io_size, and the physical sector size is greater than the block size, then use the physical sector size as a better-than-nothing hint. This should help for SSD's that have a physical sector size of 8k or 16k (which are reportedly will be coming soon). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc/mke2fs.c')
-rw-r--r--misc/mke2fs.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index a11dd8c8..fd66ff63 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1084,8 +1084,9 @@ static const char *default_files[] = { "<default>", 0 };
* Sets the geometry of a device (stripe/stride), and returns the
* device's alignment offset, if any, or a negative error.
*/
-static int ext2fs_get_device_geometry(const char *file,
- struct ext2_super_block *fs_param)
+static int get_device_geometry(const char *file,
+ struct ext2_super_block *fs_param,
+ int psector_size)
{
int rc = -1;
int blocksize;
@@ -1110,6 +1111,12 @@ static int ext2fs_get_device_geometry(const char *file,
min_io = blkid_topology_get_minimum_io_size(tp);
opt_io = blkid_topology_get_optimal_io_size(tp);
blocksize = EXT2_BLOCK_SIZE(fs_param);
+ if ((min_io == 0) && (psector_size > blocksize))
+ min_io = psector_size;
+ if ((opt_io == 0) && min_io)
+ opt_io = min_io;
+ if ((opt_io == 0) && (psector_size > blocksize))
+ opt_io = psector_size;
fs_param->s_raid_stride = min_io / blocksize;
fs_param->s_raid_stripe_width = opt_io / blocksize;
@@ -1707,7 +1714,7 @@ got_size:
int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE);
#ifdef HAVE_BLKID_PROBE_GET_TOPOLOGY
- retval = ext2fs_get_device_geometry(device_name, &fs_param);
+ retval = get_device_geometry(device_name, &fs_param, psector_size);
if (retval < 0) {
fprintf(stderr,
_("warning: Unable to get device geometry for %s\n"),