aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2005-05-01 11:59:05 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:05 -0400
commit9a3bb3017383fbb6fe56431d17f60bd0d50f0717 (patch)
tree292e5e8644bca99f80a6fb56b75b20f9ae6d9804 /fs
parenta83f1fe27f7252a2b73b4f22066e92bf99bd595b (diff)
[PATCH] reiserfs: make resize option auto-get new device size
It's trivial for the resize option to auto-get the underlying device size, while it's harder for the user. I've copied the code from jfs. Since of the different reiserfs option parser (which does not use the superior match_token used by almost every other filesystem), I've had to use the "resize=auto" and not "resize" option to specify this behaviour. Changing the option parser to the kernel one wouldn't be bad but I've no time to do this cleanup in this moment. Btw, the mount(8) man page should be updated to include this option. Cc the relevant people, please (I hope I cc'ed the right people). Cc: <reiserfs-dev@namesys.com> Cc: <reiserfs-list@namesys.com> Cc: <mtk-manpages@gmx.net> Cc: Alex Zarochentsev <zam@namesys.com> Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/reiserfs/super.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index bcdf2438d152..bc5e8893b5d5 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -889,12 +889,18 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
889 char * p; 889 char * p;
890 890
891 p = NULL; 891 p = NULL;
892 /* "resize=NNN" */ 892 /* "resize=NNN" or "resize=auto" */
893 *blocks = simple_strtoul (arg, &p, 0); 893
894 if (*p != '\0') { 894 if (!strcmp(arg, "auto")) {
895 /* NNN does not look like a number */ 895 /* From JFS code, to auto-get the size.*/
896 reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); 896 *blocks = s->s_bdev->bd_inode->i_size >> s->s_blocksize_bits;
897 return 0; 897 } else {
898 *blocks = simple_strtoul (arg, &p, 0);
899 if (*p != '\0') {
900 /* NNN does not look like a number */
901 reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg);
902 return 0;
903 }
898 } 904 }
899 } 905 }
900 906
@@ -903,7 +909,8 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
903 unsigned long val = simple_strtoul (arg, &p, 0); 909 unsigned long val = simple_strtoul (arg, &p, 0);
904 /* commit=NNN (time in seconds) */ 910 /* commit=NNN (time in seconds) */
905 if ( *p != '\0' || val >= (unsigned int)-1) { 911 if ( *p != '\0' || val >= (unsigned int)-1) {
906 reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); return 0; 912 reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg);
913 return 0;
907 } 914 }
908 *commit_max_age = (unsigned int)val; 915 *commit_max_age = (unsigned int)val;
909 } 916 }