linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 11/15] f2fs: remove f2fs_get_block
Date: Mon, 28 Nov 2022 10:15:19 +0100	[thread overview]
Message-ID: <20221128091523.1242584-12-hch@lst.de> (raw)
In-Reply-To: <20221128091523.1242584-1-hch@lst.de>

Fold f2fs_get_block into the two remaining callers to simplify the
call chain a bit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/f2fs/data.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 87c17602a3fdd4..2ae8fcf7cf49f4 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1197,13 +1197,6 @@ int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index)
 	return err;
 }
 
-static int f2fs_get_block(struct dnode_of_data *dn, pgoff_t index)
-{
-	if (f2fs_lookup_extent_cache_block(dn->inode, index, &dn->data_blkaddr))
-		return 0;
-	return f2fs_reserve_block(dn, index);
-}
-
 struct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index,
 				     blk_opf_t op_flags, bool for_write)
 {
@@ -1445,10 +1438,12 @@ static void f2fs_map_unlock(struct f2fs_sb_info *sbi, int flag)
 int f2fs_get_block_locked(struct dnode_of_data *dn, pgoff_t index)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode);
-	int err;
+	int err = 0;
 
 	f2fs_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO);
-	err = f2fs_get_block(dn, index);
+	if (!f2fs_lookup_extent_cache_block(dn->inode, index,
+					    &dn->data_blkaddr))
+		err = f2fs_reserve_block(dn, index);
 	f2fs_map_unlock(sbi, F2FS_GET_BLOCK_PRE_AIO);
 
 	return err;
@@ -3427,7 +3422,8 @@ static int __reserve_data_block(struct inode *inode, pgoff_t index,
 	}
 	set_new_dnode(&dn, inode, ipage, ipage, 0);
 
-	err = f2fs_get_block(&dn, index);
+	if (!f2fs_lookup_extent_cache_block(inode, index, &dn.data_blkaddr))
+		err = f2fs_reserve_block(&dn, index);
 
 	*blk_addr = dn.data_blkaddr;
 	*node_changed = dn.node_changed;
-- 
2.30.2



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2022-11-28  9:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28  9:15 [f2fs-dev] a fix and a bunch of cleanups Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 01/15] f2fs: don't rely on F2FS_MAP_* in f2fs_iomap_begin Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 02/15] f2fs: decouple F2FS_MAP_ from buffer head flags Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 03/15] f2fs: rename F2FS_MAP_UNWRITTEN to F2FS_MAP_DELALLOC Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 04/15] f2fs: split __submit_bio Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 05/15] f2fs: fold f2fs_lookup_extent_tree into f2fs_lookup_extent_cache Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 06/15] f2fs: add a f2fs_lookup_extent_cache_block helper Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 07/15] f2fs: add a f2fs_get_block_locked helper Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 08/15] f2fs: f2fs_do_map_lock Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 09/15] f2fs: reflow prepare_write_begin Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 10/15] f2fs: simplify __allocate_data_block Christoph Hellwig
2022-11-28  9:15 ` Christoph Hellwig [this message]
2022-11-28  9:15 ` [f2fs-dev] [PATCH 12/15] f2fs: remove the create argument to f2fs_map_blocks Christoph Hellwig
2022-12-13  1:22   ` Jaegeuk Kim
2022-12-13  5:57     ` Christoph Hellwig
2022-12-15  1:02       ` Jaegeuk Kim
2022-11-28  9:15 ` [f2fs-dev] [PATCH 13/15] f2fs: factor a f2f_map_blocks_cached helper Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 14/15] f2fs: factor out a f2fs_map_no_dnode Christoph Hellwig
2022-11-28  9:15 ` [f2fs-dev] [PATCH 15/15] f2fs: refactor the hole reporting and allocation logic in f2fs_map_blocks Christoph Hellwig
2023-01-03 17:21 ` [f2fs-dev] a fix and a bunch of cleanups Jaegeuk Kim
2023-01-06  6:54   ` Chao Yu
2023-01-11  5:58   ` Christoph Hellwig

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=20221128091523.1242584-12-hch@lst.de \
    --to=hch@lst.de \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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 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).