aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/mount.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-02-09 09:25:01 +0000
committerSteven Whitehouse <steve@dolmen.chygwyn.com>2009-03-24 11:21:20 +0000
commitf15ab5619d8068a321094f4705147764d689e88e (patch)
treec08044e928dff4628b0aa6ea17d6bc5fb922d5dc /fs/gfs2/mount.c
parentd8348de06f704fc34d24ec068546ecb1045fc11a (diff)
downloadlinux-f15ab5619d8068a321094f4705147764d689e88e.tar.gz
GFS2: Support generation of discard requests
This patch allows GFS2 to generate discard requests for blocks which are no longer useful to the filesystem (i.e. those which have been freed as the result of an unlink operation). The requests are generated at the time which those blocks become available for reuse in the filesystem. In order to use this new feature, you have to specify the "discard" mount option. The code coalesces adjacent blocks into a single extent when generating the discard requests, thus generating the minimum number. If an error occurs when the request has been sent to the block device, then it will print a message and turn off the requests for that filesystem. If the problem is temporary, then you can use remount to turn the option back on again. There is also a nodiscard mount option so that you can use remount to turn discard requests off, if required. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/mount.c')
-rw-r--r--fs/gfs2/mount.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c
index fba502aa8b2d3..ee69701a77774 100644
--- a/fs/gfs2/mount.c
+++ b/fs/gfs2/mount.c
@@ -41,6 +41,8 @@ enum {
Opt_data_writeback,
Opt_data_ordered,
Opt_meta,
+ Opt_discard,
+ Opt_nodiscard,
Opt_err,
};
@@ -65,6 +67,8 @@ static const match_table_t tokens = {
{Opt_data_writeback, "data=writeback"},
{Opt_data_ordered, "data=ordered"},
{Opt_meta, "meta"},
+ {Opt_discard, "discard"},
+ {Opt_nodiscard, "nodiscard"},
{Opt_err, NULL}
};
@@ -157,6 +161,12 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, struct gfs2_args *args, char *options)
case Opt_meta:
args->ar_meta = 1;
break;
+ case Opt_discard:
+ args->ar_discard = 1;
+ break;
+ case Opt_nodiscard:
+ args->ar_discard = 0;
+ break;
case Opt_err:
default:
fs_info(sdp, "invalid mount option: %s\n", o);