Patch "nilfs2: make superblock data array index computation sparse friendly" has been added to the 6.9-stable tree
Quoted 73 lines · Sasha Levin
This is a note to let you know that I've just added the patch titled
nilfs2: make superblock data array index computation sparse friendly
to the 6.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
nilfs2-make-superblock-data-array-index-computation-.patch
and it can be found in the queue-6.9 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
commit
5017482ff3b29550015cce7f81279dc69aefd6feAuthor: Ryusuke Konishi <[email protected]> Date: Tue Apr 30 17:00:19 2024 +0900nilfs2: make superblock data array index computation sparse friendly
[ Upstream commit
91d743a9c8299de1fc1b47428d8bb4c85face00f]Upon running sparse, "warning: dubious: x & !y" is output at an array index calculation within
nilfs_load_super_block().The calculation is not wrong, but to eliminate the sparse warning, replace it with an equivalent calculation.
Also, add a comment to make it easier to understand what the unintuitive array index calculation is doing and whether it's correct.
Fixes e339ad31f599 ("nilfs2: introduce secondary super block")Signed-off-by Ryusuke Konishi <[email protected]>Cc Bart Van Assche <[email protected]>Cc Jens Axboe <[email protected]>Cc kernel test robot <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Sasha Levin <[email protected]>fs/nilfs2/the_nilfs.c +14
-1@@ -592,7 +592,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,struct nilfs_super_block **sbp = nilfs->ns_sbp;struct buffer_head **sbh = nilfs->ns_sbh;u64 sb2off, devsize =bdev_nr_bytes (nilfs->ns_bdev); -int valid[2 ], swp =0 ; +int valid[2 ], swp =0 , older;if (devsize <NILFS_SEG_MIN_BLOCKS *NILFS_MIN_BLOCK_SIZE +4096 ) {nilfs_err (sb,"device size too small" );@@ -648,9 +648,25 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,if (swp)nilfs_swap_super_block (nilfs); +/* +* Calculate the array index of the older superblock data. +* If one has been dropped, set index 0 pointing to the remaining one, +* otherwise set index 1 pointing to the old one (including if both +* are the same). +* +* Divided case valid[0] valid[1] swp -> older +* ------------------------------------------------------------- +* Both SBs are invalid 0 0 N/A (Error) +* SB1 is invalid 0 1 1 0 +* SB2 is invalid 1 0 0 0 +* SB2 is newer 1 1 1 0 +* SB2 is older or the same 1 1 0 1
fs/nilfs2/the_nilfs.c static int nilfs_load_super_block(struct the_nilfs *nilfs, · line 672
Quoted 10 lines
fs/nilfs2/the_nilfs.c +4
-1+*/ + older = valid[1 ] ^ swp; + nilfs->ns_sbwcount =0 ; nilfs->ns_sbwtime =le64_to_cpu (sbp[0 ]->s_wtime); - nilfs->ns_prot_seq =le64_to_cpu (sbp[valid[1 ] & !swp]->s_last_seq); + nilfs->ns_prot_seq =le64_to_cpu (sbp[older]->s_last_seq); *sbpp = sbp[0 ];return 0 ; }
This commit fixes the sparse warning output by build "make C=1" with the sparse check, but does not fix any operational bugs.
Therefore, if fixing a harmless sparse warning does not meet the requirements for backporting to stable trees (I assume it does), please drop it as it is a false positive pickup. Sorry if the "Fixes:" tag is confusing.
The same goes for the same patch queued to other stable-trees.
Thanks,
Ryusuke Konishi
Quoted 88 lines · Ryusuke Konishi
Quoted 73 lines · Sasha Levin
This is a note to let you know that I've just added the patch titled
nilfs2: make superblock data array index computation sparse friendly
to the 6.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
nilfs2-make-superblock-data-array-index-computation-.patch
and it can be found in the queue-6.9 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
commit
5017482ff3b29550015cce7f81279dc69aefd6feAuthor: Ryusuke Konishi <[email protected]> Date: Tue Apr 30 17:00:19 2024 +0900nilfs2: make superblock data array index computation sparse friendly
[ Upstream commit
91d743a9c8299de1fc1b47428d8bb4c85face00f]Upon running sparse, "warning: dubious: x & !y" is output at an array index calculation within
nilfs_load_super_block().The calculation is not wrong, but to eliminate the sparse warning, replace it with an equivalent calculation.
Also, add a comment to make it easier to understand what the unintuitive array index calculation is doing and whether it's correct.
Fixes e339ad31f599 ("nilfs2: introduce secondary super block")Signed-off-by Ryusuke Konishi <[email protected]>Cc Bart Van Assche <[email protected]>Cc Jens Axboe <[email protected]>Cc kernel test robot <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Sasha Levin <[email protected]>fs/nilfs2/the_nilfs.c +14
-1@@ -592,7 +592,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,struct nilfs_super_block **sbp = nilfs->ns_sbp;struct buffer_head **sbh = nilfs->ns_sbh;u64 sb2off, devsize =bdev_nr_bytes (nilfs->ns_bdev); -int valid[2 ], swp =0 ; +int valid[2 ], swp =0 , older;if (devsize <NILFS_SEG_MIN_BLOCKS *NILFS_MIN_BLOCK_SIZE +4096 ) {nilfs_err (sb,"device size too small" );@@ -648,9 +648,25 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,if (swp)nilfs_swap_super_block (nilfs); +/* +* Calculate the array index of the older superblock data. +* If one has been dropped, set index 0 pointing to the remaining one, +* otherwise set index 1 pointing to the old one (including if both +* are the same). +* +* Divided case valid[0] valid[1] swp -> older +* ------------------------------------------------------------- +* Both SBs are invalid 0 0 N/A (Error) +* SB1 is invalid 0 1 1 0 +* SB2 is invalid 1 0 0 0 +* SB2 is newer 1 1 1 0 +* SB2 is older or the same 1 1 0 1 fs/nilfs2/the_nilfs.c static int nilfs_load_super_block(struct the_nilfs *nilfs, · line 672
Quoted 10 lines
fs/nilfs2/the_nilfs.c +4
-1+*/ + older = valid[1 ] ^ swp; + nilfs->ns_sbwcount =0 ; nilfs->ns_sbwtime =le64_to_cpu (sbp[0 ]->s_wtime); - nilfs->ns_prot_seq =le64_to_cpu (sbp[valid[1 ] & !swp]->s_last_seq); + nilfs->ns_prot_seq =le64_to_cpu (sbp[older]->s_last_seq); *sbpp = sbp[0 ];return 0 ; }This commit fixes the sparse warning output by build "make C=1" with the sparse check, but does not fix any operational bugs.
Quoted 6 lines
Therefore, if fixing a harmless sparse warning does not meet the requirements for backporting to stable trees (I assume it does), please drop it as it is a false positive pickup. Sorry if the "Fixes:" tag is confusing.
The same goes for the same patch queued to other stable-trees.
Now dropped, thanks!
greg k-h