diff mbox series

[2/2] ntfs: remove redundant check buffer_uptodate()

Message ID 1619425013-130530-3-git-send-email-haoxu@linux.alibaba.com (mailing list archive)
State New
Headers show
Series remove redundant check buffer_uptodate() | expand

Commit Message

Hao Xu April 26, 2021, 8:16 a.m. UTC
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 mbox series

Patch

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);
 			/*