aboutsummaryrefslogtreecommitdiff
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2017-07-06 14:46:01 -0700
committerMoyster <oysterized@gmail.com>2017-07-21 12:38:16 +0200
commit53a60ebd6f7253aabdbad7a08360437b80fc03ad (patch)
tree72ced6ccfc34552c9c6a47aff4c007dfb43055b2 /fs/f2fs/data.c
parent279f42412973312b80c9ef35a91747c7f402c60c (diff)
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/data.c')
-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 3e4aa92e9..10eb16e4d 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2220,8 +2220,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,