提交 a79d5881 编写于 作者: M Matthew Wilcox (Oracle) 提交者: Zheng Zengkai

dax: account DAX entries as nrpages

mainline inclusion
from mainline-v5.13-rc1
commit 7f0e07fb
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I3ZE5V
CVE: NA

-------------------------------------------------

Simplify mapping_needs_writeback() by accounting DAX entries as pages
instead of exceptional entries.

Link: https://lkml.kernel.org/r/20201026151849.24232-4-willy@infradead.orgSigned-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: NVishal Verma <vishal.l.verma@intel.com>
Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>

Conflicts:
	fs/dax.c
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NTong Tiangen <tongtiangen@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 f4834f6b
...@@ -536,7 +536,7 @@ static void *grab_mapping_entry(struct xa_state *xas, ...@@ -536,7 +536,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
dax_disassociate_entry(entry, mapping, false); dax_disassociate_entry(entry, mapping, false);
xas_store(xas, NULL); /* undo the PMD join */ xas_store(xas, NULL); /* undo the PMD join */
dax_wake_entry(xas, entry, WAKE_ALL); dax_wake_entry(xas, entry, WAKE_ALL);
mapping->nrexceptional--; mapping->nrpages -= PG_PMD_NR;
entry = NULL; entry = NULL;
xas_set(xas, index); xas_set(xas, index);
} }
...@@ -552,7 +552,7 @@ static void *grab_mapping_entry(struct xa_state *xas, ...@@ -552,7 +552,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
dax_lock_entry(xas, entry); dax_lock_entry(xas, entry);
if (xas_error(xas)) if (xas_error(xas))
goto out_unlock; goto out_unlock;
mapping->nrexceptional++; mapping->nrpages += 1UL << order;
} }
out_unlock: out_unlock:
...@@ -672,7 +672,7 @@ static int __dax_invalidate_entry(struct address_space *mapping, ...@@ -672,7 +672,7 @@ static int __dax_invalidate_entry(struct address_space *mapping,
goto out; goto out;
dax_disassociate_entry(entry, mapping, trunc); dax_disassociate_entry(entry, mapping, trunc);
xas_store(&xas, NULL); xas_store(&xas, NULL);
mapping->nrexceptional--; mapping->nrpages -= 1UL << dax_entry_order(entry);
ret = 1; ret = 1;
out: out:
put_unlocked_entry(&xas, entry, WAKE_ALL); put_unlocked_entry(&xas, entry, WAKE_ALL);
......
...@@ -616,9 +616,6 @@ EXPORT_SYMBOL(filemap_fdatawait_keep_errors); ...@@ -616,9 +616,6 @@ EXPORT_SYMBOL(filemap_fdatawait_keep_errors);
/* Returns true if writeback might be needed or already in progress. */ /* Returns true if writeback might be needed or already in progress. */
static bool mapping_needs_writeback(struct address_space *mapping) static bool mapping_needs_writeback(struct address_space *mapping)
{ {
if (dax_mapping(mapping))
return mapping->nrexceptional;
return mapping->nrpages; return mapping->nrpages;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册