Commit ff1048e7 authored by Jaegeuk Kim's avatar Jaegeuk Kim

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: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 000519f2
...@@ -2203,8 +2203,12 @@ int f2fs_migrate_page(struct address_space *mapping, ...@@ -2203,8 +2203,12 @@ int f2fs_migrate_page(struct address_space *mapping,
BUG_ON(PageWriteback(page)); BUG_ON(PageWriteback(page));
/* migrating an atomic written page is safe with the inmem_lock hold */ /* migrating an atomic written page is safe with the inmem_lock hold */
if (atomic_written && !mutex_trylock(&fi->inmem_lock)) if (atomic_written) {
if (mode != MIGRATE_SYNC)
return -EBUSY;
if (!mutex_trylock(&fi->inmem_lock))
return -EAGAIN; return -EAGAIN;
}
/* /*
* A reference is expected if PagePrivate set when move mapping, * A reference is expected if PagePrivate set when move mapping,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment