summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-05-11 20:03:49 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2015-06-01 16:20:50 -0700
commit40a02be1781f726ee015bcf7c8961a71a2a50f05 (patch)
treeb8e11bd1c98bd2c78500663974ed6303d5d7642b /fs/f2fs/segment.c
parent498c5e9fcd10c89404601b222c1dbcb6e4f10a02 (diff)
downloadop-kernel-dev-40a02be1781f726ee015bcf7c8961a71a2a50f05.zip
op-kernel-dev-40a02be1781f726ee015bcf7c8961a71a2a50f05.tar.gz
f2fs: do not issue next dnode discard redundantly
We have a discard map, so that we can avoid redundant discard issues. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 2c40ce1..342e0f7 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -486,7 +486,20 @@ static int f2fs_issue_discard(struct f2fs_sb_info *sbi,
void discard_next_dnode(struct f2fs_sb_info *sbi, block_t blkaddr)
{
- if (f2fs_issue_discard(sbi, blkaddr, 1)) {
+ int err = -ENOTSUPP;
+
+ if (test_opt(sbi, DISCARD)) {
+ struct seg_entry *se = get_seg_entry(sbi,
+ GET_SEGNO(sbi, blkaddr));
+ unsigned int offset = GET_BLKOFF_FROM_SEG0(sbi, blkaddr);
+
+ if (f2fs_test_bit(offset, se->discard_map))
+ return;
+
+ err = f2fs_issue_discard(sbi, blkaddr, 1);
+ }
+
+ if (err) {
struct page *page = grab_meta_page(sbi, blkaddr);
/* zero-filled page */
set_page_dirty(page);
OpenPOWER on IntegriCloud