From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 1 May 2005 15:59:05 +0000 (-0700) Subject: [PATCH] reiserfs: make resize option auto-get new device size X-Git-Tag: v2.6.12-rc4~136^2~88 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a3bb3017383fbb6fe56431d17f60bd0d50f0717;p=profile%2Fivi%2Fkernel-x86-ivi.git [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: Cc: Cc: Cc: Alex Zarochentsev Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index bcdf243..bc5e889 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 char * p; p = NULL; - /* "resize=NNN" */ - *blocks = simple_strtoul (arg, &p, 0); - if (*p != '\0') { - /* NNN does not look like a number */ - reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); - return 0; + /* "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); + if (*p != '\0') { + /* NNN does not look like a number */ + reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg); + return 0; + } } } @@ -903,7 +909,8 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st unsigned long val = simple_strtoul (arg, &p, 0); /* commit=NNN (time in seconds) */ 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; }