From: Theodore Ts'o Date: Fri, 24 Sep 2010 14:12:54 +0000 (-0400) Subject: debugfs: Add the -D option to request Direct I/O X-Git-Tag: v1.41.13~26 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0fd68e0241e944545d43045593e82b0fb7317797;p=tools%2Fe2fsprogs.git debugfs: Add the -D option to request Direct I/O Signed-off-by: "Theodore Ts'o" --- diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in index 9012a56..b488685 100644 --- a/debugfs/debugfs.8.in +++ b/debugfs/debugfs.8.in @@ -8,7 +8,7 @@ debugfs \- ext2/ext3/ext4 file system debugger .SH SYNOPSIS .B debugfs [ -.B \-Vwci +.B \-DVwci ] [ .B \-b @@ -106,7 +106,14 @@ to read in commands from and execute them. When .B debugfs is finished executing those commands, it will exit. -.TP +.TP +.I -D +Causes +.B debugfs +to open the device using Direct I/O, bypassing the buffer cache. Note +that some Linux devices, notably device mapper as of this writing, do +not support Direct I/O. +.TP .I -R request Causes .B debugfs @@ -255,7 +262,7 @@ Free the inode specified by .TP .I help Print a list of commands understood by -.BR debugfs (8). +.BR debugfs . .TP .I icheck block ... Print a listing of the inodes which use the one or more blocks specified @@ -364,7 +371,7 @@ device numbers must be specified. Take the requested list of inode numbers, and print a listing of pathnames to those inodes. .TP -.I open [-w] [-e] [-f] [-i] [-c] [-b blocksize] [-s superblock] device +.I open [-w] [-e] [-f] [-i] [-c] [-D] [-b blocksize] [-s superblock] device Open a filesystem for editing. The .I -f flag forces the filesystem to be opened even if there are some unknown @@ -372,7 +379,7 @@ or incompatible filesystem features which would normally prevent the filesystem from being opened. The .I -e flag causes the filesystem to be opened in exclusive mode. The -.IR -b ", " -c ", " -i ", " -s ", and " -w +.IR -b ", " -c ", " -i ", " -s ", " -w ", and " -D options behave the same as the command-line options to .BR debugfs . .TP @@ -511,7 +518,7 @@ into the destination file. .TP .B DEBUGFS_PAGER, PAGER The -.BR debugfs (8) +.B debugfs program always pipes the output of the some commands through a pager program. These commands include: .IR show_super_stats , diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 1edddc7..5019fe7 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -131,7 +131,7 @@ void do_open_filesys(int argc, char **argv) char *data_filename = 0; reset_getopt(); - while ((c = getopt (argc, argv, "iwfecb:s:d:")) != EOF) { + while ((c = getopt (argc, argv, "iwfecb:s:d:D")) != EOF) { switch (c) { case 'i': open_flags |= EXT2_FLAG_IMAGE_FILE; @@ -151,6 +151,9 @@ void do_open_filesys(int argc, char **argv) case 'd': data_filename = optarg; break; + case 'D': + open_flags |= EXT2_FLAG_DIRECT_IO; + break; case 'b': blocksize = parse_ulong(optarg, argv[0], "block size", &err); @@ -2160,7 +2163,7 @@ int main(int argc, char **argv) fprintf (stderr, "%s %s (%s)\n", debug_prog_name, E2FSPROGS_VERSION, E2FSPROGS_DATE); - while ((c = getopt (argc, argv, "iwcR:f:b:s:Vd:")) != EOF) { + while ((c = getopt (argc, argv, "iwcR:f:b:s:Vd:D")) != EOF) { switch (c) { case 'R': request = optarg; @@ -2177,6 +2180,9 @@ int main(int argc, char **argv) case 'w': open_flags |= EXT2_FLAG_RW; break; + case 'D': + open_flags |= EXT2_FLAG_DIRECT_IO; + break; case 'b': blocksize = parse_ulong(optarg, argv[0], "block size", 0);