Skip to content

Commit 937c262

Browse files
Saphereyejankara
authored andcommitted
fs: udf: avoid assignment in condition when selecting allocation goal
Avoid assignment inside an if condition when choosing the block allocation goal in inode_getblk(), and make the priority order explicit. No functional change. [JK: Fixup conditions to really not change functionality] Signed-off-by: Adarsh Das <adarshdas950@gmail.com> Link: https://patch.msgid.link/20260206125638.94194-1-adarshdas950@gmail.com Signed-off-by: Jan Kara <jack@suse.cz>
1 parent f4d0ec0 commit 937c262

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

fs/udf/inode.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ static int inode_getblk(struct inode *inode, struct udf_map_rq *map)
734734
sector_t offset = 0;
735735
int8_t etype, tmpetype;
736736
struct udf_inode_info *iinfo = UDF_I(inode);
737-
udf_pblk_t goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
737+
udf_pblk_t goal = 0, pgoal = 0;
738738
int lastblock = 0;
739739
bool isBeyondEOF = false;
740740
int ret = 0;
@@ -893,11 +893,10 @@ static int inode_getblk(struct inode *inode, struct udf_map_rq *map)
893893
else { /* otherwise, allocate a new block */
894894
if (iinfo->i_next_alloc_block == map->lblk)
895895
goal = iinfo->i_next_alloc_goal;
896-
897-
if (!goal) {
898-
if (!(goal = pgoal)) /* XXX: what was intended here? */
899-
goal = iinfo->i_location.logicalBlockNum + 1;
900-
}
896+
if (!goal)
897+
goal = pgoal;
898+
if (!goal)
899+
goal = iinfo->i_location.logicalBlockNum + 1;
901900

902901
newblocknum = udf_new_block(inode->i_sb, inode,
903902
iinfo->i_location.partitionReferenceNum,

0 commit comments

Comments
 (0)