summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/segment.c
diff options
context:
space:
mode:
authorJiro SEKIBA <jir@unicus.jp>2010-01-30 18:06:35 +0900
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-02-13 12:26:02 +0900
commite902ec9906e844f4613fa6190c6fa65f162dc86e (patch)
treeee0ea829ae04a30fb01c119f050a3967304e55ba /fs/nilfs2/segment.c
parent724e6d3fe8003c3f60bf404bf22e4e331327c596 (diff)
downloadtalos-obmc-linux-e902ec9906e844f4613fa6190c6fa65f162dc86e.tar.gz
talos-obmc-linux-e902ec9906e844f4613fa6190c6fa65f162dc86e.zip
nilfs2: issue discard request after cleaning segments
This adds a function to send discard requests for given array of segment numbers, and calls the function when garbage collection succeeded. Signed-off-by: Jiro SEKIBA <jir@unicus.jp> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r--fs/nilfs2/segment.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 105b508b47a8..9280b0f10792 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2560,6 +2560,16 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(sci->sc_interval);
}
+ if (nilfs_test_opt(sbi, DISCARD)) {
+ int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs,
+ sci->sc_nfreesegs);
+ if (ret) {
+ printk(KERN_WARNING
+ "NILFS warning: error %d on discard request, "
+ "turning discards off for the device\n", ret);
+ nilfs_clear_opt(sbi, DISCARD);
+ }
+ }
out_unlock:
sci->sc_freesegs = NULL;
OpenPOWER on IntegriCloud