Commit 9a3bb301 authored by Paolo 'Blaisorblade' Giarrusso's avatar Paolo 'Blaisorblade' Giarrusso Committed by Linus Torvalds

[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: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a83f1fe2
...@@ -889,7 +889,12 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st ...@@ -889,7 +889,12 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
char * p; char * p;
p = NULL; p = NULL;
/* "resize=NNN" */ /* "resize=NNN" or "resize=auto" */
if (!strcmp(arg, "auto")) {
/* From JFS code, to auto-get the size.*/
*blocks = s->s_bdev->bd_inode->i_size >> s->s_blocksize_bits;
} else {
*blocks = simple_strtoul (arg, &p, 0); *blocks = simple_strtoul (arg, &p, 0);
if (*p != '\0') { if (*p != '\0') {
/* NNN does not look like a number */ /* NNN does not look like a number */
...@@ -897,13 +902,15 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st ...@@ -897,13 +902,15 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
return 0; return 0;
} }
} }
}
if ( c == 'c' ) { if ( c == 'c' ) {
char *p = NULL; char *p = NULL;
unsigned long val = simple_strtoul (arg, &p, 0); unsigned long val = simple_strtoul (arg, &p, 0);
/* commit=NNN (time in seconds) */ /* commit=NNN (time in seconds) */
if ( *p != '\0' || val >= (unsigned int)-1) { if ( *p != '\0' || val >= (unsigned int)-1) {
reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); return 0; reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg);
return 0;
} }
*commit_max_age = (unsigned int)val; *commit_max_age = (unsigned int)val;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment