From: zhangjun <openzhangj@gmail.com>
To: Richard Weinberger <richard@nod.at>,
Artem Bityutskiy <dedekind1@gmail.com>,
Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
zhangjun <openzhangj@gmail.com>
Subject: ubifs: fix page_count in ->ubifs_migrate_page()
Date: Wed, 12 Dec 2018 09:13:57 -0500 [thread overview]
Message-ID: <1544624037-3436-1-git-send-email-openzhangj@gmail.com> (raw)
Because the PagePrivate() in UBIFS is different meanings,
alloc_cma() will fail when one dirty page cache located in
the type of MIGRATE_CMA
If not adjust the 'extra_count' for dirty page,
ubifs_migrate_page() -> migrate_page_move_mapping() will
always return -EAGAIN for:
expected_count += page_has_private(page)
This causes the migration to fail until the page cache is cleaned
In general, PagePrivate() indicates that buff_head is already bound
to this page, and at the same time page_count() will also increase.
But UBIFS set private flag when the cache is dirty, and page_count()
not increase.
Therefore, the expected_count of UBIFS is different from the general
case.
Signed-off-by: zhangjun <openzhangj@gmail.com>
---
fs/ubifs/file.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 1b78f2e..2136a5c 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1480,8 +1480,15 @@ static int ubifs_migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page, enum migrate_mode mode)
{
int rc;
+ int extra_count;
- rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
+ /*
+ * UBIFS is using PagePrivate() which can have different meanings across
+ * filesystems. So here adjusting the 'extra_count' make it work.
+ */
+ extra_count = 0 - page_has_private(page);
+ rc = migrate_page_move_mapping(mapping, newpage,
+ page, NULL, mode, extra_count);
if (rc != MIGRATEPAGE_SUCCESS)
return rc;
--
2.7.4
next reply other threads:[~2018-12-12 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 14:13 zhangjun [this message]
2018-12-13 14:23 ` ubifs: fix page_count in ->ubifs_migrate_page() Richard Weinberger
2018-12-13 15:14 ` zhangjun
2018-12-13 22:57 ` Dave Chinner
2018-12-14 6:15 ` zhangjun
2018-12-14 9:12 ` Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1544624037-3436-1-git-send-email-openzhangj@gmail.com \
--to=openzhangj@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=dedekind1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox