summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-07-06 23:46:01 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2017-07-07 19:34:48 +0200
commitff1048e7dffe0582a50e2eaf90e13fc76ea8493d (patch)
tree455e87c95239a8b0096098bac9ee1ffaa342c05d /fs/f2fs
parentf2fs: don't count inode block in in-memory inode.i_blocks (diff)
downloadlinux-ff1048e7dffe0582a50e2eaf90e13fc76ea8493d.tar.xz
linux-ff1048e7dffe0582a50e2eaf90e13fc76ea8493d.zip
f2fs: relax migratepage for atomic written page
In order to avoid lock contention for atomic written pages, we'd better give EBUSY in f2fs_migrate_page when mode is asynchronous. We expect it will be released soon as transaction commits. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/data.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index cffcfa8d2571..72fc866cad19 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2203,8 +2203,12 @@ int f2fs_migrate_page(struct address_space *mapping,
BUG_ON(PageWriteback(page));
/* migrating an atomic written page is safe with the inmem_lock hold */
- if (atomic_written && !mutex_trylock(&fi->inmem_lock))
- return -EAGAIN;
+ if (atomic_written) {
+ if (mode != MIGRATE_SYNC)
+ return -EBUSY;
+ if (!mutex_trylock(&fi->inmem_lock))
+ return -EAGAIN;
+ }
/*
* A reference is expected if PagePrivate set when move mapping,