public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] erofs: get rid of erofs_inode_datablocks()
@ 2023-02-04  9:30 Gao Xiang
  2023-02-04  9:30 ` [PATCH 2/6] erofs: avoid tagged pointers to mark sync decompression Gao Xiang
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Gao Xiang @ 2023-02-04  9:30 UTC (permalink / raw)
  To: linux-erofs, Chao Yu, Yue Hu, Jeffle Xu; +Cc: LKML, Gao Xiang

erofs_inode_datablocks() has the only one caller, let's just get
rid of it entirely.  No logic changes.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/internal.h |  6 ------
 fs/erofs/namei.c    | 18 +++++-------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 08ba817d6551..c18af21ba9c4 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -344,12 +344,6 @@ static inline erofs_off_t erofs_iloc(struct inode *inode)
 		(EROFS_I(inode)->nid << sbi->islotbits);
 }
 
-static inline unsigned long erofs_inode_datablocks(struct inode *inode)
-{
-	/* since i_size cannot be changed */
-	return DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);
-}
-
 static inline unsigned int erofs_bitrange(unsigned int value, unsigned int bit,
 					  unsigned int bits)
 {
diff --git a/fs/erofs/namei.c b/fs/erofs/namei.c
index b64a108fac92..966eabc61c13 100644
--- a/fs/erofs/namei.c
+++ b/fs/erofs/namei.c
@@ -5,7 +5,6 @@
  * Copyright (C) 2022, Alibaba Cloud
  */
 #include "xattr.h"
-
 #include <trace/events/erofs.h>
 
 struct erofs_qstr {
@@ -87,19 +86,13 @@ static struct erofs_dirent *find_target_dirent(struct erofs_qstr *name,
 	return ERR_PTR(-ENOENT);
 }
 
-static void *find_target_block_classic(struct erofs_buf *target,
-				       struct inode *dir,
-				       struct erofs_qstr *name,
-				       int *_ndirents)
+static void *erofs_find_target_block(struct erofs_buf *target,
+		struct inode *dir, struct erofs_qstr *name, int *_ndirents)
 {
-	unsigned int startprfx, endprfx;
-	int head, back;
+	int head = 0, back = DIV_ROUND_UP(dir->i_size, EROFS_BLKSIZ) - 1;
+	unsigned int startprfx = 0, endprfx = 0;
 	void *candidate = ERR_PTR(-ENOENT);
 
-	startprfx = endprfx = 0;
-	head = 0;
-	back = erofs_inode_datablocks(dir) - 1;
-
 	while (head <= back) {
 		const int mid = head + (back - head) / 2;
 		struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
@@ -180,8 +173,7 @@ int erofs_namei(struct inode *dir, const struct qstr *name, erofs_nid_t *nid,
 	qn.end = name->name + name->len;
 
 	ndirents = 0;
-
-	de = find_target_block_classic(&buf, dir, &qn, &ndirents);
+	de = erofs_find_target_block(&buf, dir, &qn, &ndirents);
 	if (IS_ERR(de))
 		return PTR_ERR(de);
 
-- 
2.24.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-02-14 14:47 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-04  9:30 [PATCH 1/6] erofs: get rid of erofs_inode_datablocks() Gao Xiang
2023-02-04  9:30 ` [PATCH 2/6] erofs: avoid tagged pointers to mark sync decompression Gao Xiang
2023-02-06  1:50   ` Yue Hu
2023-02-14 14:42   ` Chao Yu
2023-02-04  9:30 ` [PATCH 3/6] erofs: remove tagged pointer helpers Gao Xiang
2023-02-06  2:06   ` Yue Hu
2023-02-14 14:44   ` Chao Yu
2023-02-04  9:30 ` [PATCH 4/6] erofs: move zdata.h into zdata.c Gao Xiang
2023-02-06  2:14   ` Yue Hu
2023-02-14 14:44   ` Chao Yu
2023-02-04  9:30 ` [PATCH 5/6] erofs: get rid of z_erofs_do_map_blocks() forward declaration Gao Xiang
2023-02-06  1:26   ` Yue Hu
2023-02-14 14:45   ` Chao Yu
2023-02-04  9:30 ` [PATCH 6/6] erofs: tidy up internal.h Gao Xiang
2023-02-06  2:26   ` Yue Hu
2023-02-07  8:48   ` Jingbo Xu
2023-02-14 14:46   ` Chao Yu
2023-02-06  1:16 ` [PATCH 1/6] erofs: get rid of erofs_inode_datablocks() Yue Hu
2023-02-07  8:27 ` Jingbo Xu
2023-02-14 13:45 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox