From: Jaegeuk Kim Date: Thu, 6 Jul 2017 21:46:01 +0000 (-0700) Subject: f2fs: relax migratepage for atomic written page X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ff1048e7dffe0582a50e2eaf90e13fc76ea8493d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Jaegeuk Kim --- 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,