diff options
author | Konstantin Khlebnikov <khlebnikov@yandex-team.ru> | 2019-09-24 00:34:48 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-25 00:54:08 +0200 |
commit | 875d91b11a201276ac3a9ab79f8b0fa3dc4ee8fd (patch) | |
tree | 3a74f57e68611b86acf4addb674aca8220dfaa64 /mm/filemap.c | |
parent | mm/filemap.c: don't initiate writeback if mapping has no dirty pages (diff) | |
download | linux-875d91b11a201276ac3a9ab79f8b0fa3dc4ee8fd.tar.xz linux-875d91b11a201276ac3a9ab79f8b0fa3dc4ee8fd.zip |
mm/filemap.c: rewrite mapping_needs_writeback in less fancy manner
This actually checks that writeback is needed or in progress.
Link: http://lkml.kernel.org/r/156378817069.1087.1302816672037672488.stgit@buzz
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r-- | mm/filemap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 82f3b9a3a940..d5462d706f76 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -618,10 +618,13 @@ int filemap_fdatawait_keep_errors(struct address_space *mapping) } EXPORT_SYMBOL(filemap_fdatawait_keep_errors); +/* Returns true if writeback might be needed or already in progress. */ static bool mapping_needs_writeback(struct address_space *mapping) { - return (!dax_mapping(mapping) && mapping->nrpages) || - (dax_mapping(mapping) && mapping->nrexceptional); + if (dax_mapping(mapping)) + return mapping->nrexceptional; + + return mapping->nrpages; } int filemap_write_and_wait(struct address_space *mapping) |