All of lore.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: linux-btrfs@vger.kernel.org
Cc: kernel-team@fb.com
Subject: [PATCH 6/9] btrfs: remove redundant i_size check in __extent_writepage_io()
Date: Mon,  2 Dec 2019 17:34:22 -0800	[thread overview]
Message-ID: <365cd6fdadd6a91c22ccf61fcb1deb688763a176.1575336816.git.osandov@fb.com> (raw)
In-Reply-To: <cover.1575336815.git.osandov@fb.com>

From: Omar Sandoval <osandov@fb.com>

In __extent_writepage_io(), we check whether
i_size <= page_offset(page).

Note that if i_size < page_offset(page), then
i_size >> PAGE_SHIFT < page->index. If i_size == page_offset(page), then
i_size >> PAGE_SHIFT == page->index && offset_in_page(i_size) == 0.

__extent_writepage() already has a check for these cases that
returns without calling __extent_writepage_io():

  end_index = i_size >> PAGE_SHIFT
  pg_offset = offset_in_page(i_size);
  if (page->index > end_index ||
     (page->index == end_index && !pg_offset)) {
          page->mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
          unlock_page(page);
          return 0;
  }

Get rid of the one in __extent_writepage_io(), which was obsoleted in
211c17f51f46 ("Fix corners in writepage and btrfs_truncate_page").

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 fs/btrfs/extent_io.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 8622282db31e..635f5d2954a4 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3455,11 +3455,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
 	update_nr_written(wbc, nr_written + 1);
 
 	end = page_end;
-	if (i_size <= start) {
-		btrfs_writepage_endio_finish_ordered(page, start, page_end, 1);
-		goto done;
-	}
-
 	blocksize = inode->i_sb->s_blocksize;
 
 	while (cur <= end) {
@@ -3540,7 +3535,6 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
 		pg_offset += iosize;
 		nr++;
 	}
-done:
 	*nr_ret = nr;
 	return ret;
 }
-- 
2.24.0


  parent reply	other threads:[~2019-12-03  1:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03  1:34 [PATCH 0/9] btrfs: miscellaneous cleanups Omar Sandoval
2019-12-03  1:34 ` [PATCH 1/9] btrfs: get rid of trivial __btrfs_lookup_bio_sums() wrappers Omar Sandoval
2019-12-03  8:36   ` Johannes Thumshirn
2019-12-10 17:12   ` David Sterba
2019-12-10 18:24     ` Omar Sandoval
2019-12-10 18:26       ` David Sterba
2019-12-10 18:37         ` [PATCH] btrfs: get rid of at_offset parameter to btrfs_lookup_bio_sums() Omar Sandoval
2019-12-03  1:34 ` [PATCH 2/9] btrfs: remove dead snapshot-aware defrag code Omar Sandoval
2019-12-03  8:38   ` Johannes Thumshirn
2019-12-10 17:22   ` David Sterba
2019-12-03  1:34 ` [PATCH 3/9] btrfs: make btrfs_ordered_extent naming consistent with btrfs_file_extent_item Omar Sandoval
2019-12-03  9:51   ` Johannes Thumshirn
2019-12-10 18:22   ` David Sterba
2019-12-10 18:32     ` Omar Sandoval
2019-12-10 18:48       ` David Sterba
2019-12-03  1:34 ` [PATCH 4/9] btrfs: remove unnecessary pg_offset assignments in __extent_writepage() Omar Sandoval
2019-12-03 12:59   ` Johannes Thumshirn
2019-12-03  1:34 ` [PATCH 5/9] btrfs: remove trivial goto label " Omar Sandoval
2019-12-03 13:06   ` Johannes Thumshirn
2019-12-03  1:34 ` Omar Sandoval [this message]
2019-12-10 17:45   ` [PATCH 6/9] btrfs: remove redundant i_size check in __extent_writepage_io() David Sterba
2019-12-03  1:34 ` [PATCH 7/9] btrfs: drop create parameter to btrfs_get_extent() Omar Sandoval
2019-12-03  7:47   ` Omar Sandoval
2019-12-03  1:34 ` [PATCH 8/9] btrfs: simplify compressed/inline check in __extent_writepage_io() Omar Sandoval
2019-12-03 13:17   ` Johannes Thumshirn
2019-12-03  1:34 ` [PATCH 9/9] btrfs: remove struct find_free_extent.ram_bytes Omar Sandoval
2019-12-03 13:27   ` Johannes Thumshirn
2019-12-03 18:01     ` Omar Sandoval
2019-12-10 18:47 ` [PATCH 0/9] btrfs: miscellaneous cleanups David Sterba
2019-12-10 18:50   ` Omar Sandoval

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=365cd6fdadd6a91c22ccf61fcb1deb688763a176.1575336816.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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.