diff options
author | Karel Zak | 2014-08-20 11:43:02 +0200 |
---|---|---|
committer | Karel Zak | 2014-08-20 11:43:02 +0200 |
commit | 6b11aad26b29d4984965ff1044184117c0955843 (patch) | |
tree | 1a577084410f1a7b9df888fa32dd269861125f90 /libfdisk/src/context.c | |
parent | tests: fix fdisk/bsd for the two possible sectors/offsets (diff) | |
download | kernel-qcow2-util-linux-6b11aad26b29d4984965ff1044184117c0955843.tar.gz kernel-qcow2-util-linux-6b11aad26b29d4984965ff1044184117c0955843.tar.xz kernel-qcow2-util-linux-6b11aad26b29d4984965ff1044184117c0955843.zip |
libfdisk: fix fdisk_get_optimal_iosize() and update tests
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/context.c')
-rw-r--r-- | libfdisk/src/context.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index 8aaa49726..423244817 100644 --- a/libfdisk/src/context.c +++ b/libfdisk/src/context.c @@ -645,12 +645,16 @@ unsigned int fdisk_get_units_per_sector(struct fdisk_context *cxt) * fdisk_get_optimal_iosize: * @cxt: context * + * The optimal I/O is optional and does not have to be provided by device, + * anyway libfdisk never returns zero. If the optimal I/O size is not provided + * then libfdisk returns minimal I/O size or sector size. + * * Returns: optimal I/O size */ unsigned long fdisk_get_optimal_iosize(struct fdisk_context *cxt) { assert(cxt); - return cxt->optimal_io_size; + return cxt->optimal_io_size ? cxt->optimal_io_size : cxt->io_size; } /** |