All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hao Xu <haoxu@linux.alibaba.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	Anton Altaparmakov <anton@tuxera.com>
Cc: linux-fsdevel@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net,
	Joseph Qi <joseph.qi@linux.alibaba.com>
Subject: [PATCH 2/2] ntfs: remove redundant check buffer_uptodate()
Date: Mon, 26 Apr 2021 16:16:53 +0800	[thread overview]
Message-ID: <1619425013-130530-3-git-send-email-haoxu@linux.alibaba.com> (raw)
In-Reply-To: <1619425013-130530-1-git-send-email-haoxu@linux.alibaba.com>

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


      parent reply	other threads:[~2021-04-26  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1619425013-130530-3-git-send-email-haoxu@linux.alibaba.com \
    --to=haoxu@linux.alibaba.com \
    --cc=anton@tuxera.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-ntfs-dev@lists.sourceforge.net \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.