diff options
Diffstat (limited to 'fs/jfs/super.c')
-rw-r--r-- | fs/jfs/super.c | 71 |
1 files changed, 56 insertions, 15 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index c55c7452d28..6f4ac1c070f 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
35 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
36 | #include <linux/blkdev.h> | ||
36 | 37 | ||
37 | #include "jfs_incore.h" | 38 | #include "jfs_incore.h" |
38 | #include "jfs_filsys.h" | 39 | #include "jfs_filsys.h" |
@@ -100,7 +101,7 @@ void jfs_error(struct super_block *sb, const char * function, ...) | |||
100 | vsnprintf(error_buf, sizeof(error_buf), function, args); | 101 | vsnprintf(error_buf, sizeof(error_buf), function, args); |
101 | va_end(args); | 102 | va_end(args); |
102 | 103 | ||
103 | printk(KERN_ERR "ERROR: (device %s): %s\n", sb->s_id, error_buf); | 104 | pr_err("ERROR: (device %s): %s\n", sb->s_id, error_buf); |
104 | 105 | ||
105 | jfs_handle_error(sb); | 106 | jfs_handle_error(sb); |
106 | } | 107 | } |
@@ -197,7 +198,8 @@ static void jfs_put_super(struct super_block *sb) | |||
197 | enum { | 198 | enum { |
198 | Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize, | 199 | Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize, |
199 | Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota, | 200 | Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota, |
200 | Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask | 201 | Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask, |
202 | Opt_discard, Opt_nodiscard, Opt_discard_minblk | ||
201 | }; | 203 | }; |
202 | 204 | ||
203 | static const match_table_t tokens = { | 205 | static const match_table_t tokens = { |
@@ -214,6 +216,9 @@ static const match_table_t tokens = { | |||
214 | {Opt_uid, "uid=%u"}, | 216 | {Opt_uid, "uid=%u"}, |
215 | {Opt_gid, "gid=%u"}, | 217 | {Opt_gid, "gid=%u"}, |
216 | {Opt_umask, "umask=%u"}, | 218 | {Opt_umask, "umask=%u"}, |
219 | {Opt_discard, "discard"}, | ||
220 | {Opt_nodiscard, "nodiscard"}, | ||
221 | {Opt_discard_minblk, "discard=%u"}, | ||
217 | {Opt_err, NULL} | 222 | {Opt_err, NULL} |
218 | }; | 223 | }; |
219 | 224 | ||
@@ -255,8 +260,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
255 | else { | 260 | else { |
256 | nls_map = load_nls(args[0].from); | 261 | nls_map = load_nls(args[0].from); |
257 | if (!nls_map) { | 262 | if (!nls_map) { |
258 | printk(KERN_ERR | 263 | pr_err("JFS: charset not found\n"); |
259 | "JFS: charset not found\n"); | ||
260 | goto cleanup; | 264 | goto cleanup; |
261 | } | 265 | } |
262 | } | 266 | } |
@@ -272,8 +276,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
272 | *newLVSize = sb->s_bdev->bd_inode->i_size >> | 276 | *newLVSize = sb->s_bdev->bd_inode->i_size >> |
273 | sb->s_blocksize_bits; | 277 | sb->s_blocksize_bits; |
274 | if (*newLVSize == 0) | 278 | if (*newLVSize == 0) |
275 | printk(KERN_ERR | 279 | pr_err("JFS: Cannot determine volume size\n"); |
276 | "JFS: Cannot determine volume size\n"); | ||
277 | break; | 280 | break; |
278 | } | 281 | } |
279 | case Opt_errors: | 282 | case Opt_errors: |
@@ -294,8 +297,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
294 | *flag &= ~JFS_ERR_REMOUNT_RO; | 297 | *flag &= ~JFS_ERR_REMOUNT_RO; |
295 | *flag |= JFS_ERR_PANIC; | 298 | *flag |= JFS_ERR_PANIC; |
296 | } else { | 299 | } else { |
297 | printk(KERN_ERR | 300 | pr_err("JFS: %s is an invalid error handler\n", |
298 | "JFS: %s is an invalid error handler\n", | ||
299 | errors); | 301 | errors); |
300 | goto cleanup; | 302 | goto cleanup; |
301 | } | 303 | } |
@@ -314,8 +316,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
314 | case Opt_usrquota: | 316 | case Opt_usrquota: |
315 | case Opt_grpquota: | 317 | case Opt_grpquota: |
316 | case Opt_quota: | 318 | case Opt_quota: |
317 | printk(KERN_ERR | 319 | pr_err("JFS: quota operations not supported\n"); |
318 | "JFS: quota operations not supported\n"); | ||
319 | break; | 320 | break; |
320 | #endif | 321 | #endif |
321 | case Opt_uid: | 322 | case Opt_uid: |
@@ -324,23 +325,61 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
324 | sbi->uid = simple_strtoul(uid, &uid, 0); | 325 | sbi->uid = simple_strtoul(uid, &uid, 0); |
325 | break; | 326 | break; |
326 | } | 327 | } |
328 | |||
327 | case Opt_gid: | 329 | case Opt_gid: |
328 | { | 330 | { |
329 | char *gid = args[0].from; | 331 | char *gid = args[0].from; |
330 | sbi->gid = simple_strtoul(gid, &gid, 0); | 332 | sbi->gid = simple_strtoul(gid, &gid, 0); |
331 | break; | 333 | break; |
332 | } | 334 | } |
335 | |||
333 | case Opt_umask: | 336 | case Opt_umask: |
334 | { | 337 | { |
335 | char *umask = args[0].from; | 338 | char *umask = args[0].from; |
336 | sbi->umask = simple_strtoul(umask, &umask, 8); | 339 | sbi->umask = simple_strtoul(umask, &umask, 8); |
337 | if (sbi->umask & ~0777) { | 340 | if (sbi->umask & ~0777) { |
338 | printk(KERN_ERR | 341 | pr_err("JFS: Invalid value of umask\n"); |
339 | "JFS: Invalid value of umask\n"); | ||
340 | goto cleanup; | 342 | goto cleanup; |
341 | } | 343 | } |
342 | break; | 344 | break; |
343 | } | 345 | } |
346 | |||
347 | case Opt_discard: | ||
348 | { | ||
349 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | ||
350 | /* if set to 1, even copying files will cause | ||
351 | * trimming :O | ||
352 | * -> user has more control over the online trimming | ||
353 | */ | ||
354 | sbi->minblks_trim = 64; | ||
355 | if (blk_queue_discard(q)) { | ||
356 | *flag |= JFS_DISCARD; | ||
357 | } else { | ||
358 | pr_err("JFS: discard option " \ | ||
359 | "not supported on device\n"); | ||
360 | } | ||
361 | break; | ||
362 | } | ||
363 | |||
364 | case Opt_nodiscard: | ||
365 | *flag &= ~JFS_DISCARD; | ||
366 | break; | ||
367 | |||
368 | case Opt_discard_minblk: | ||
369 | { | ||
370 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | ||
371 | char *minblks_trim = args[0].from; | ||
372 | if (blk_queue_discard(q)) { | ||
373 | *flag |= JFS_DISCARD; | ||
374 | sbi->minblks_trim = simple_strtoull( | ||
375 | minblks_trim, &minblks_trim, 0); | ||
376 | } else { | ||
377 | pr_err("JFS: discard option " \ | ||
378 | "not supported on device\n"); | ||
379 | } | ||
380 | break; | ||
381 | } | ||
382 | |||
344 | default: | 383 | default: |
345 | printk("jfs: Unrecognized mount option \"%s\" " | 384 | printk("jfs: Unrecognized mount option \"%s\" " |
346 | " or missing value\n", p); | 385 | " or missing value\n", p); |
@@ -374,8 +413,8 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
374 | 413 | ||
375 | if (newLVSize) { | 414 | if (newLVSize) { |
376 | if (sb->s_flags & MS_RDONLY) { | 415 | if (sb->s_flags & MS_RDONLY) { |
377 | printk(KERN_ERR | 416 | pr_err("JFS: resize requires volume" \ |
378 | "JFS: resize requires volume to be mounted read-write\n"); | 417 | " to be mounted read-write\n"); |
379 | return -EROFS; | 418 | return -EROFS; |
380 | } | 419 | } |
381 | rc = jfs_extendfs(sb, newLVSize, 0); | 420 | rc = jfs_extendfs(sb, newLVSize, 0); |
@@ -457,7 +496,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
457 | #endif | 496 | #endif |
458 | 497 | ||
459 | if (newLVSize) { | 498 | if (newLVSize) { |
460 | printk(KERN_ERR "resize option for remount only\n"); | 499 | pr_err("resize option for remount only\n"); |
461 | goto out_kfree; | 500 | goto out_kfree; |
462 | } | 501 | } |
463 | 502 | ||
@@ -625,6 +664,8 @@ static int jfs_show_options(struct seq_file *seq, struct dentry *root) | |||
625 | seq_printf(seq, ",umask=%03o", sbi->umask); | 664 | seq_printf(seq, ",umask=%03o", sbi->umask); |
626 | if (sbi->flag & JFS_NOINTEGRITY) | 665 | if (sbi->flag & JFS_NOINTEGRITY) |
627 | seq_puts(seq, ",nointegrity"); | 666 | seq_puts(seq, ",nointegrity"); |
667 | if (sbi->flag & JFS_DISCARD) | ||
668 | seq_printf(seq, ",discard=%u", sbi->minblks_trim); | ||
628 | if (sbi->nls_tab) | 669 | if (sbi->nls_tab) |
629 | seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset); | 670 | seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset); |
630 | if (sbi->flag & JFS_ERR_CONTINUE) | 671 | if (sbi->flag & JFS_ERR_CONTINUE) |