Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Adarsh Das and committed by
Jan Kara
937c262d f4d0ec0a

+5 -6
+5 -6
fs/udf/inode.c
··· 734 734 sector_t offset = 0; 735 735 int8_t etype, tmpetype; 736 736 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; 738 738 int lastblock = 0; 739 739 bool isBeyondEOF = false; 740 740 int ret = 0; ··· 893 893 else { /* otherwise, allocate a new block */ 894 894 if (iinfo->i_next_alloc_block == map->lblk) 895 895 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; 901 900 902 901 newblocknum = udf_new_block(inode->i_sb, inode, 903 902 iinfo->i_location.partitionReferenceNum,