diff options
author | Yang Guo <[email protected]> | 2021-02-24 12:02:48 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2021-02-24 13:38:28 -0800 |
commit | 4ebd3aec3842662300979dacd6fb38e3e8edf7f4 (patch) | |
tree | 5c88f3a4390297fe73d8ac51e9613b35f4fc0a87 | |
parent | 826ea860bc4d119731026655c383c7773c9d2dad (diff) |
fs/buffer.c: add checking buffer head stat before clear
clear_buffer_new() is used to clear buffer new stat. When PAGE_SIZE is
64K, most buffer heads in the list are not needed to clear.
clear_buffer_new() has an enpensive atomic modification operation, Let's
add checking buffer head before clear it as __block_write_begin_int does
which is good for performance.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Yang Guo <[email protected]>
Signed-off-by: Shaokun Zhang <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: Nick Piggin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | fs/buffer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 32647d2011df..f1c3a5b27a90 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2083,7 +2083,8 @@ static int __block_commit_write(struct inode *inode, struct page *page, set_buffer_uptodate(bh); mark_buffer_dirty(bh); } - clear_buffer_new(bh); + if (buffer_new(bh)) + clear_buffer_new(bh); block_start = block_end; bh = bh->b_this_page; |