* [PATCH 0/2] remove redundant check buffer_uptodate()
@ 2021-04-26 8:16 Hao Xu
2021-04-26 8:16 ` [PATCH 1/2] fs: " Hao Xu
2021-04-26 8:16 ` [PATCH 2/2] ntfs: " Hao Xu
0 siblings, 2 replies; 3+ messages in thread
From: Hao Xu @ 2021-04-26 8:16 UTC (permalink / raw)
To: Alexander Viro, Anton Altaparmakov
Cc: linux-fsdevel, linux-ntfs-dev, Joseph Qi
Now set_buffer_uptodate() will test first and then set, so we don't have
to check buffer_uptodate() first, remove it to simplify code.
Hao Xu (2):
fs: remove redundant check buffer_uptodate()
ntfs: remove redundant check buffer_uptodate()
fs/buffer.c | 9 +++------
fs/ntfs/file.c | 9 +++------
fs/ntfs/logfile.c | 3 +--
3 files changed, 7 insertions(+), 14 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] fs: remove redundant check buffer_uptodate()
2021-04-26 8:16 [PATCH 0/2] remove redundant check buffer_uptodate() Hao Xu
@ 2021-04-26 8:16 ` Hao Xu
2021-04-26 8:16 ` [PATCH 2/2] ntfs: " Hao Xu
1 sibling, 0 replies; 3+ messages in thread
From: Hao Xu @ 2021-04-26 8:16 UTC (permalink / raw)
To: Alexander Viro, Anton Altaparmakov
Cc: linux-fsdevel, linux-ntfs-dev, Joseph Qi
Now set_buffer_uptodate() will test first and then set, so we don't have
to check buffer_uptodate() first, remove it to simplify code.
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
---
fs/buffer.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 0cb7ffd4977c..195f224edd8e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1997,10 +1997,8 @@ int __block_write_begin_int(struct page *page, loff_t pos, unsigned len,
block++, block_start=block_end, bh = bh->b_this_page) {
block_end = block_start + blocksize;
if (block_end <= from || block_start >= to) {
- if (PageUptodate(page)) {
- if (!buffer_uptodate(bh))
- set_buffer_uptodate(bh);
- }
+ if (PageUptodate(page))
+ set_buffer_uptodate(bh);
continue;
}
if (buffer_new(bh))
@@ -2031,8 +2029,7 @@ int __block_write_begin_int(struct page *page, loff_t pos, unsigned len,
}
}
if (PageUptodate(page)) {
- if (!buffer_uptodate(bh))
- set_buffer_uptodate(bh);
+ set_buffer_uptodate(bh);
continue;
}
if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ntfs: remove redundant check buffer_uptodate()
2021-04-26 8:16 [PATCH 0/2] remove redundant check buffer_uptodate() Hao Xu
2021-04-26 8:16 ` [PATCH 1/2] fs: " Hao Xu
@ 2021-04-26 8:16 ` Hao Xu
1 sibling, 0 replies; 3+ messages in thread
From: Hao Xu @ 2021-04-26 8:16 UTC (permalink / raw)
To: Alexander Viro, Anton Altaparmakov
Cc: linux-fsdevel, linux-ntfs-dev, Joseph Qi
Now set_buffer_uptodate() will test first and then set, so we don't have
to check buffer_uptodate() first, remove it to simplify code.
Signed-off-by: Hao Xu <haoxu@linux.alibaba.com>
---
fs/ntfs/file.c | 9 +++------
fs/ntfs/logfile.c | 3 +--
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index e5aab265dff1..08b6bdf2cc2f 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -719,8 +719,7 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
* error recovery.
*/
if (PageUptodate(page)) {
- if (!buffer_uptodate(bh))
- set_buffer_uptodate(bh);
+ set_buffer_uptodate(bh);
if (unlikely(was_hole)) {
/* We allocated the buffer. */
clean_bdev_bh_alias(bh);
@@ -814,8 +813,7 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
read_unlock_irqrestore(&ni->size_lock, flags);
if (bh_pos > initialized_size) {
if (PageUptodate(page)) {
- if (!buffer_uptodate(bh))
- set_buffer_uptodate(bh);
+ set_buffer_uptodate(bh);
} else if (!buffer_uptodate(bh)) {
zero_user(page, bh_offset(bh), blocksize);
set_buffer_uptodate(bh);
@@ -938,8 +936,7 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
* debatable and this could be removed.
*/
if (PageUptodate(page)) {
- if (!buffer_uptodate(bh))
- set_buffer_uptodate(bh);
+ set_buffer_uptodate(bh);
} else if (!buffer_uptodate(bh)) {
zero_user(page, bh_offset(bh),
blocksize);
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
index bc1bf217b38e..9695540ce581 100644
--- a/fs/ntfs/logfile.c
+++ b/fs/ntfs/logfile.c
@@ -796,8 +796,7 @@ bool ntfs_empty_logfile(struct inode *log_vi)
get_bh(bh);
/* Set the entire contents of the buffer to 0xff. */
memset(bh->b_data, -1, block_size);
- if (!buffer_uptodate(bh))
- set_buffer_uptodate(bh);
+ set_buffer_uptodate(bh);
if (buffer_dirty(bh))
clear_buffer_dirty(bh);
/*
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-26 8:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 8:16 [PATCH 0/2] remove redundant check buffer_uptodate() Hao Xu
2021-04-26 8:16 ` [PATCH 1/2] fs: " Hao Xu
2021-04-26 8:16 ` [PATCH 2/2] ntfs: " Hao Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).