From: Adarsh Das <adarshdas950@gmail.com>
To: jack@suse.com
Cc: linux-kernel@vger.kernel.org, Adarsh Das <adarshdas950@gmail.com>
Subject: [PATCH] fs: udf: avoid assignment in condition when selecting allocation goal
Date: Fri, 6 Feb 2026 18:26:38 +0530 [thread overview]
Message-ID: <20260206125638.94194-1-adarshdas950@gmail.com> (raw)
Avoid assignment inside an if condition when choosing the block
allocation goal in inode_getblk(), and make the priority order
explicit. No functional change.
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
---
fs/udf/inode.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 7fae8002344a..4a4cb42319af 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -734,7 +734,7 @@ static int inode_getblk(struct inode *inode, struct udf_map_rq *map)
sector_t offset = 0;
int8_t etype, tmpetype;
struct udf_inode_info *iinfo = UDF_I(inode);
- udf_pblk_t goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
+ udf_pblk_t goal = 0, pgoal = 0;
int lastblock = 0;
bool isBeyondEOF = false;
int ret = 0;
@@ -893,11 +893,10 @@ static int inode_getblk(struct inode *inode, struct udf_map_rq *map)
else { /* otherwise, allocate a new block */
if (iinfo->i_next_alloc_block == map->lblk)
goal = iinfo->i_next_alloc_goal;
-
- if (!goal) {
- if (!(goal = pgoal)) /* XXX: what was intended here? */
- goal = iinfo->i_location.logicalBlockNum + 1;
- }
+ else if (pgoal)
+ goal = pgoal;
+ else
+ goal = iinfo->i_location.logicalBlockNum + 1;
newblocknum = udf_new_block(inode->i_sb, inode,
iinfo->i_location.partitionReferenceNum,
--
2.53.0
next reply other threads:[~2026-02-06 12:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 12:56 Adarsh Das [this message]
2026-02-06 16:05 ` 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=20260206125638.94194-1-adarshdas950@gmail.com \
--to=adarshdas950@gmail.com \
--cc=jack@suse.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®