diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-07-05 01:27:04 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-07-22 21:02:12 -0400 |
commit | 802d31775404ee335ca1e97a82e1e706a4c843be (patch) | |
tree | 3753263ea97748e6c2b01f29fb7f81c19381eb7b | |
parent | 773bc4f3b6898634a80a41c72a1f34cb89992dcd (diff) |
nilfs2: add nodiscard mount option
Nilfs has "discard" mount option which issues discard/TRIM commands to
underlying block device, but it lacks a complementary option and has
no way to disable the feature through remount.
This adds "nodiscard" option to resolve this imbalance.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
-rw-r--r-- | Documentation/filesystems/nilfs2.txt | 7 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/Documentation/filesystems/nilfs2.txt b/Documentation/filesystems/nilfs2.txt index 54f61c0ff442..d5c0cef38a71 100644 --- a/Documentation/filesystems/nilfs2.txt +++ b/Documentation/filesystems/nilfs2.txt | |||
@@ -77,9 +77,10 @@ norecovery Disable recovery of the filesystem on mount. | |||
77 | This disables every write access on the device for | 77 | This disables every write access on the device for |
78 | read-only mounts or snapshots. This option will fail | 78 | read-only mounts or snapshots. This option will fail |
79 | for r/w mounts on an unclean volume. | 79 | for r/w mounts on an unclean volume. |
80 | discard Issue discard/TRIM commands to the underlying block | 80 | discard This enables/disables the use of discard/TRIM commands. |
81 | device when blocks are freed. This is useful for SSD | 81 | nodiscard(*) The discard/TRIM commands are sent to the underlying |
82 | devices and sparse/thinly-provisioned LUNs. | 82 | block device when blocks are freed. This is useful |
83 | for SSD devices and sparse/thinly-provisioned LUNs. | ||
83 | 84 | ||
84 | NILFS2 usage | 85 | NILFS2 usage |
85 | ============ | 86 | ============ |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 13b0e955c028..9da12211aac1 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -604,7 +604,7 @@ static const struct export_operations nilfs_export_ops = { | |||
604 | enum { | 604 | enum { |
605 | Opt_err_cont, Opt_err_panic, Opt_err_ro, | 605 | Opt_err_cont, Opt_err_panic, Opt_err_ro, |
606 | Opt_barrier, Opt_nobarrier, Opt_snapshot, Opt_order, Opt_norecovery, | 606 | Opt_barrier, Opt_nobarrier, Opt_snapshot, Opt_order, Opt_norecovery, |
607 | Opt_discard, Opt_err, | 607 | Opt_discard, Opt_nodiscard, Opt_err, |
608 | }; | 608 | }; |
609 | 609 | ||
610 | static match_table_t tokens = { | 610 | static match_table_t tokens = { |
@@ -617,6 +617,7 @@ static match_table_t tokens = { | |||
617 | {Opt_order, "order=%s"}, | 617 | {Opt_order, "order=%s"}, |
618 | {Opt_norecovery, "norecovery"}, | 618 | {Opt_norecovery, "norecovery"}, |
619 | {Opt_discard, "discard"}, | 619 | {Opt_discard, "discard"}, |
620 | {Opt_nodiscard, "nodiscard"}, | ||
620 | {Opt_err, NULL} | 621 | {Opt_err, NULL} |
621 | }; | 622 | }; |
622 | 623 | ||
@@ -676,6 +677,9 @@ static int parse_options(char *options, struct super_block *sb) | |||
676 | case Opt_discard: | 677 | case Opt_discard: |
677 | nilfs_set_opt(sbi, DISCARD); | 678 | nilfs_set_opt(sbi, DISCARD); |
678 | break; | 679 | break; |
680 | case Opt_nodiscard: | ||
681 | nilfs_clear_opt(sbi, DISCARD); | ||
682 | break; | ||
679 | default: | 683 | default: |
680 | printk(KERN_ERR | 684 | printk(KERN_ERR |
681 | "NILFS: Unrecognized mount option \"%s\"\n", p); | 685 | "NILFS: Unrecognized mount option \"%s\"\n", p); |