diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-03 11:48:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-03 11:48:21 -0400 |
commit | eb0ad9c06d51edb5d18a7007fd4d77a8805b2ba7 (patch) | |
tree | 987595aa0cfa6e9fdf367a1ec3f5e8b04849c777 /fs/jfs/super.c | |
parent | 1f7df953d687860690cc0e388d0efec215c09e9c (diff) | |
parent | 84f4141ee3ea11035f741d4298cb6bbad1850fcf (diff) |
Merge tag 'jfs-3.7' of git://github.com/kleikamp/linux-shaggy
Pull JFS update from Dave Kleikamp:
"JFS TRIM support and some minor fixes"
* tag 'jfs-3.7' of git://github.com/kleikamp/linux-shaggy:
jfs: Fix do_div precision in commit b40c2e66
JFS: use list_move instead of list_del/list_add
jfs: Remove obsolete email address
fs/jfs: TRIM support for JFS Filesystem
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 efdf8835dfca..1a543be09c79 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: |
@@ -327,6 +328,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
327 | goto cleanup; | 328 | goto cleanup; |
328 | break; | 329 | break; |
329 | } | 330 | } |
331 | |||
330 | case Opt_gid: | 332 | case Opt_gid: |
331 | { | 333 | { |
332 | char *gid = args[0].from; | 334 | char *gid = args[0].from; |
@@ -336,17 +338,54 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
336 | goto cleanup; | 338 | goto cleanup; |
337 | break; | 339 | break; |
338 | } | 340 | } |
341 | |||
339 | case Opt_umask: | 342 | case Opt_umask: |
340 | { | 343 | { |
341 | char *umask = args[0].from; | 344 | char *umask = args[0].from; |
342 | sbi->umask = simple_strtoul(umask, &umask, 8); | 345 | sbi->umask = simple_strtoul(umask, &umask, 8); |
343 | if (sbi->umask & ~0777) { | 346 | if (sbi->umask & ~0777) { |
344 | printk(KERN_ERR | 347 | pr_err("JFS: Invalid value of umask\n"); |
345 | "JFS: Invalid value of umask\n"); | ||
346 | goto cleanup; | 348 | goto cleanup; |
347 | } | 349 | } |
348 | break; | 350 | break; |
349 | } | 351 | } |
352 | |||
353 | case Opt_discard: | ||
354 | { | ||
355 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | ||
356 | /* if set to 1, even copying files will cause | ||
357 | * trimming :O | ||
358 | * -> user has more control over the online trimming | ||
359 | */ | ||
360 | sbi->minblks_trim = 64; | ||
361 | if (blk_queue_discard(q)) { | ||
362 | *flag |= JFS_DISCARD; | ||
363 | } else { | ||
364 | pr_err("JFS: discard option " \ | ||
365 | "not supported on device\n"); | ||
366 | } | ||
367 | break; | ||
368 | } | ||
369 | |||
370 | case Opt_nodiscard: | ||
371 | *flag &= ~JFS_DISCARD; | ||
372 | break; | ||
373 | |||
374 | case Opt_discard_minblk: | ||
375 | { | ||
376 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | ||
377 | char *minblks_trim = args[0].from; | ||
378 | if (blk_queue_discard(q)) { | ||
379 | *flag |= JFS_DISCARD; | ||
380 | sbi->minblks_trim = simple_strtoull( | ||
381 | minblks_trim, &minblks_trim, 0); | ||
382 | } else { | ||
383 | pr_err("JFS: discard option " \ | ||
384 | "not supported on device\n"); | ||
385 | } | ||
386 | break; | ||
387 | } | ||
388 | |||
350 | default: | 389 | default: |
351 | printk("jfs: Unrecognized mount option \"%s\" " | 390 | printk("jfs: Unrecognized mount option \"%s\" " |
352 | " or missing value\n", p); | 391 | " or missing value\n", p); |
@@ -380,8 +419,8 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
380 | 419 | ||
381 | if (newLVSize) { | 420 | if (newLVSize) { |
382 | if (sb->s_flags & MS_RDONLY) { | 421 | if (sb->s_flags & MS_RDONLY) { |
383 | printk(KERN_ERR | 422 | pr_err("JFS: resize requires volume" \ |
384 | "JFS: resize requires volume to be mounted read-write\n"); | 423 | " to be mounted read-write\n"); |
385 | return -EROFS; | 424 | return -EROFS; |
386 | } | 425 | } |
387 | rc = jfs_extendfs(sb, newLVSize, 0); | 426 | rc = jfs_extendfs(sb, newLVSize, 0); |
@@ -465,7 +504,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
465 | #endif | 504 | #endif |
466 | 505 | ||
467 | if (newLVSize) { | 506 | if (newLVSize) { |
468 | printk(KERN_ERR "resize option for remount only\n"); | 507 | pr_err("resize option for remount only\n"); |
469 | goto out_kfree; | 508 | goto out_kfree; |
470 | } | 509 | } |
471 | 510 | ||
@@ -633,6 +672,8 @@ static int jfs_show_options(struct seq_file *seq, struct dentry *root) | |||
633 | seq_printf(seq, ",umask=%03o", sbi->umask); | 672 | seq_printf(seq, ",umask=%03o", sbi->umask); |
634 | if (sbi->flag & JFS_NOINTEGRITY) | 673 | if (sbi->flag & JFS_NOINTEGRITY) |
635 | seq_puts(seq, ",nointegrity"); | 674 | seq_puts(seq, ",nointegrity"); |
675 | if (sbi->flag & JFS_DISCARD) | ||
676 | seq_printf(seq, ",discard=%u", sbi->minblks_trim); | ||
636 | if (sbi->nls_tab) | 677 | if (sbi->nls_tab) |
637 | seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset); | 678 | seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset); |
638 | if (sbi->flag & JFS_ERR_CONTINUE) | 679 | if (sbi->flag & JFS_ERR_CONTINUE) |