summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorKarel Zak2007-06-29 11:38:54 +0200
committerKarel Zak2007-06-29 11:38:54 +0200
commitc2a1e7880895bbd0ecdd50984ebbf9e68b745e8e (patch)
treed6c5b8cb681961f8f1369f5375b7078e8e563fad /disk-utils
parentagetty: check gethostname() return value (diff)
downloadkernel-qcow2-util-linux-c2a1e7880895bbd0ecdd50984ebbf9e68b745e8e.tar.gz
kernel-qcow2-util-linux-c2a1e7880895bbd0ecdd50984ebbf9e68b745e8e.tar.xz
kernel-qcow2-util-linux-c2a1e7880895bbd0ecdd50984ebbf9e68b745e8e.zip
blockdev: add BLKFRAGET/BLKFRASET ioctls
In Linux 2.6 the BLKRASET ioctl has the desired effect for mounted file-systems. In Linux 2.4 it appears to set the number of blocks to read-ahead on the *device* as opposed to within a *file*, and the maximum value of this number is 255. As a result the invocation of blockdev will fail on Linux 2.4 for any usefully large value of READAHEAD, and will not in any case have the desired affect for fragmented files. (Based on the blockdev-getfra-setfra.patch Debian patch.) Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/blockdev.86
-rw-r--r--disk-utils/blockdev.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/disk-utils/blockdev.8 b/disk-utils/blockdev.8
index bde64265f..86c29dd2f 100644
--- a/disk-utils/blockdev.8
+++ b/disk-utils/blockdev.8
@@ -48,6 +48,12 @@ Set readahead to
.B \--getra
Print readahead (in 512-byte sectors).
.TP
+.BI \--setfra " N"
+Set filesystem readahead (same like --setra on 2.6 kernels).
+.TP
+.B \--getfra
+Get filesystem readahead.
+.TP
.B \--flushbufs
Flush buffers.
.TP
diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c
index c07fb30ad..6cd038f10 100644
--- a/disk-utils/blockdev.c
+++ b/disk-utils/blockdev.c
@@ -23,6 +23,8 @@
#define BLKFLSBUF _IO(0x12,97)
#define BLKRASET _IO(0x12,98)
#define BLKRAGET _IO(0x12,99)
+#define BLKFRASET _IO(0x12,100)
+#define BLKFRAGET _IO(0x12,101)
#define BLKSSZGET _IO(0x12,104)
#define BLKBSZGET _IOR(0x12,112,size_t)
#define BLKBSZSET _IOW(0x12,113,size_t)
@@ -86,6 +88,12 @@ struct bdc {
#ifdef BLKRAGET
{ "--getra", "BLKRAGET", BLKRAGET, ARGLINTG, -1, NULL, N_("get readahead") },
#endif
+#ifdef BLKFRASET
+ { "--setfra", "BLKFRASET", BLKFRASET, ARGINTA, 0, "FSREADAHEAD", N_("set filesystem readahead") },
+#endif
+#ifdef BLKFRAGET
+ { "--getfra", "BLKFRAGET", BLKFRAGET, ARGLINTG, -1, NULL, N_("get filesystem readahead") },
+#endif
#ifdef BLKFLSBUF
{ "--flushbufs", "BLKFLSBUF", BLKFLSBUF, ARGNONE, 0, NULL, N_("flush buffers") },
#endif