Commit 937c262d authored by Adarsh Das's avatar Adarsh Das Committed by Jan Kara
Browse files

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: default avatarAdarsh Das <adarshdas950@gmail.com>
Link: https://patch.msgid.link/20260206125638.94194-1-adarshdas950@gmail.com


Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent f4d0ec0a
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -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? */
		if (!goal)
			goal = pgoal;
		if (!goal)
			goal = iinfo->i_location.logicalBlockNum + 1;
		}

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