From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, "linux-erofs@lists.ozlabs.org,
LKML" <linux-kernel@vger.kernel.org>, Yue Hu <huyue2@coolpad.com>,
Jingbo Xu <jefflexu@linux.alibaba.com>, Chao Yu <chao@kernel.org>,
Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH 6.1 654/798] erofs: get rid of erofs_inode_datablocks()
Date: Mon, 14 Oct 2024 16:20:08 +0200 [thread overview]
Message-ID: <20241014141243.744899671@linuxfoundation.org> (raw)
In-Reply-To: <20241014141217.941104064@linuxfoundation.org>
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <hsiangkao@linux.alibaba.com>
commit 4efdec36dc9907628e590a68193d6d8e5e74d032 upstream.
erofs_inode_datablocks() has the only one caller, let's just get
rid of it entirely. No logic changes.
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Stable-dep-of: 9ed50b8231e3 ("erofs: fix incorrect symlink detection in fast symlink")
Link: https://lore.kernel.org/r/20230204093040.97967-1-hsiangkao@linux.alibaba.com
[ Gao Xiang: apply this to 6.6.y to avoid further backport twists
due to obsoleted EROFS_BLKSIZ. ]
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Obsoleted EROFS_BLKSIZ impedes efforts to backport
9ed50b8231e3 ("erofs: fix incorrect symlink detection in fast symlink")
9e2f9d34dd12 ("erofs: handle overlapped pclusters out of crafted images properly")
To avoid further bugfix conflicts due to random EROFS_BLKSIZs
around the whole codebase, just backport the dependencies for 6.1.y.
fs/erofs/internal.h | 6 ------
fs/erofs/namei.c | 18 +++++-------------
2 files changed, 5 insertions(+), 19 deletions(-)
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -347,12 +347,6 @@ static inline erofs_off_t erofs_iloc(str
(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)
{
--- 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_
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
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);
next prev parent reply other threads:[~2024-10-14 15:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 14:09 [PATCH 6.1 000/798] 6.1.113-rc1 review Greg Kroah-Hartman
2024-10-14 14:19 ` [PATCH 6.1 624/798] arm64: Add Cortex-715 CPU part definition Greg Kroah-Hartman
2024-10-14 14:20 ` Greg Kroah-Hartman [this message]
2024-10-14 14:20 ` [PATCH 6.1 655/798] erofs: get rid of z_erofs_do_map_blocks() forward declaration Greg Kroah-Hartman
2024-10-14 14:20 ` [PATCH 6.1 656/798] erofs: avoid hardcoded blocksize for subpage block support Greg Kroah-Hartman
2024-10-14 14:20 ` [PATCH 6.1 657/798] erofs: set block size to the on-disk block size Greg Kroah-Hartman
2024-10-14 14:20 ` [PATCH 6.1 658/798] erofs: fix incorrect symlink detection in fast symlink Greg Kroah-Hartman
2024-10-14 14:20 ` [PATCH 6.1 672/798] perf lock: Dynamically allocate lockhash_table Greg Kroah-Hartman
2024-10-14 20:35 ` [PATCH 6.1 000/798] 6.1.113-rc1 review Florian Fainelli
2024-10-15 3:43 ` Peter Schneider
2024-10-15 5:31 ` Jon Hunter
2024-10-15 5:50 ` Jon Hunter
2024-10-15 11:18 ` Greg Kroah-Hartman
2024-10-15 6:29 ` Pavel Machek
2024-10-15 7:06 ` Geert Uytterhoeven
2024-10-15 7:07 ` Geert Uytterhoeven
2024-10-15 9:38 ` Oleksij Rempel
2024-10-15 7:47 ` Naresh Kamboju
2024-10-15 8:53 ` Naresh Kamboju
2024-10-15 9:50 ` Heiko Carstens
2024-10-15 11:14 ` Greg Kroah-Hartman
2024-10-15 14:40 ` Shuah Khan
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=20241014141243.744899671@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=chao@kernel.org \
--cc=hsiangkao@linux.alibaba.com \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox