All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>
Subject: [PATCH 09/22] udf: Fold udf_block_map() into udf_map_block()
Date: Tue, 24 Jan 2023 13:17:55 +0100	[thread overview]
Message-ID: <20230124121814.25951-9-jack@suse.cz> (raw)
In-Reply-To: <20230124120835.21728-1-jack@suse.cz>

udf_block_map() has now only a single caller. Fold it there.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/udf/inode.c   | 38 ++++++++++++++------------------------
 fs/udf/udfdecl.h |  1 -
 2 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 53d2d8fef158..e098d69991d0 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -341,9 +341,21 @@ static int udf_map_block(struct inode *inode, struct udf_map_rq *map)
 
 	map->oflags = 0;
 	if (!(map->iflags & UDF_MAP_CREATE)) {
-		map->pblk = udf_block_map(inode, map->lblk);
-		if (map->pblk != 0)
+		struct kernel_lb_addr eloc;
+		uint32_t elen;
+		sector_t offset;
+		struct extent_position epos = {};
+
+		down_read(&iinfo->i_data_sem);
+		if (inode_bmap(inode, map->lblk, &epos, &eloc, &elen, &offset)
+				== (EXT_RECORDED_ALLOCATED >> 30)) {
+			map->pblk = udf_get_lb_pblock(inode->i_sb, &eloc,
+							offset);
 			map->oflags |= UDF_BLK_MAPPED;
+		}
+		up_read(&iinfo->i_data_sem);
+		brelse(epos.bh);
+
 		return 0;
 	}
 
@@ -2293,25 +2305,3 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
 
 	return etype;
 }
-
-udf_pblk_t udf_block_map(struct inode *inode, sector_t block)
-{
-	struct kernel_lb_addr eloc;
-	uint32_t elen;
-	sector_t offset;
-	struct extent_position epos = {};
-	udf_pblk_t ret;
-
-	down_read(&UDF_I(inode)->i_data_sem);
-
-	if (inode_bmap(inode, block, &epos, &eloc, &elen, &offset) ==
-						(EXT_RECORDED_ALLOCATED >> 30))
-		ret = udf_get_lb_pblock(inode->i_sb, &eloc, offset);
-	else
-		ret = 0;
-
-	up_read(&UDF_I(inode)->i_data_sem);
-	brelse(epos.bh);
-
-	return ret;
-}
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index d791458fe52a..98b4d89b4368 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -158,7 +158,6 @@ extern struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block,
 extern int udf_setsize(struct inode *, loff_t);
 extern void udf_evict_inode(struct inode *);
 extern int udf_write_inode(struct inode *, struct writeback_control *wbc);
-extern udf_pblk_t udf_block_map(struct inode *inode, sector_t block);
 extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *,
 			 struct kernel_lb_addr *, uint32_t *, sector_t *);
 extern int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,
-- 
2.35.3


  parent reply	other threads:[~2023-01-24 12:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 12:17 [PATCH 0/22] udf: Fix couple of preallocation related bugs Jan Kara
2023-01-24 12:17 ` [PATCH 01/22] udf: Unify types in anchor block detection Jan Kara
2023-01-24 12:17 ` [PATCH 02/22] udf: Drop VARCONV support Jan Kara
2023-01-24 12:17 ` [PATCH 03/22] udf: Move incrementing of goal block directly into inode_getblk() Jan Kara
2023-01-24 12:17 ` [PATCH 04/22] udf: Factor out block mapping into udf_map_block() Jan Kara
2023-01-24 12:17 ` [PATCH 05/22] udf: Use udf_bread() in udf_get_pblock_virt15() Jan Kara
2023-01-24 12:17 ` [PATCH 06/22] udf: Use udf_bread() in udf_load_vat() Jan Kara
2023-01-24 12:17 ` [PATCH 07/22] udf: Do not call udf_block_map() on ICB files Jan Kara
2023-01-24 12:17 ` [PATCH 08/22] udf: Convert udf_symlink_filler() to use udf_bread() Jan Kara
2023-01-24 12:17 ` Jan Kara [this message]
2023-01-24 12:17 ` [PATCH 10/22] udf: Pass mapping request into inode_getblk() Jan Kara
2023-01-24 12:17 ` [PATCH 11/22] udf: Add flag to disable block preallocation Jan Kara
2023-01-24 12:17 ` [PATCH 12/22] udf: Use udf_map_block() in udf_getblk() Jan Kara
2023-01-24 12:17 ` [PATCH 13/22] udf: Fold udf_getblk() into udf_bread() Jan Kara
2023-01-24 12:18 ` [PATCH 14/22] udf: Protect rename against modification of moved directory Jan Kara
2023-01-24 12:18 ` [PATCH 15/22] udf: Push i_data_sem locking into udf_expand_file_adinicb() Jan Kara
2023-01-24 12:18 ` [PATCH 16/22] udf: Push i_data_sem locking into udf_extend_file() Jan Kara
2023-01-24 12:18 ` [PATCH 17/22] udf: Simplify error handling in udf_file_write_iter() Jan Kara
2023-01-24 12:18 ` [PATCH 18/22] udf: Protect truncate and file type conversion with invalidate_lock Jan Kara
2023-01-24 12:18 ` [PATCH 19/22] udf: Allocate blocks on write page fault Jan Kara
2023-01-24 12:18 ` [PATCH 20/22] udf: Do not allocate blocks on page writeback Jan Kara
2023-01-24 12:18 ` [PATCH 21/22] udf: Fix file corruption when appending just after end of preallocated extent Jan Kara
2023-01-24 12:18 ` [PATCH 22/22] udf: Fix off-by-one error when discarding preallocation Jan Kara

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=20230124121814.25951-9-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@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.