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

ext4: remove unneeded check of nr_to_submit

cppcheck reports
fs/ext4/page-io.c:516:51: style:
Condition 'nr_to_submit' is always true [knownConditionTrueFalse]
if (fscrypt_inode_uses_fs_layer_crypto(inode) && nr_to_submit) {
^
This earlier check to bail, makes this check unncessary
/* Nothing to submit? Just unlock the page... */
if (!nr_to_submit)
return 0;

Signed-off-by: Tom Rix <trix@redhat.com>
Fixes: dff4ac75eeee ("ext4: move keep_towrite handling to ext4_bio_write_page()")
Reviewed-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20230316204831.2472537-1-trix@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Tom Rix and committed by
Theodore Ts'o
8ae56b4e 54902099

+1 -1
+1 -1
fs/ext4/page-io.c
··· 510 510 * (e.g. holes) to be unnecessarily encrypted, but this is rare and 511 511 * can't happen in the common case of blocksize == PAGE_SIZE. 512 512 */ 513 - if (fscrypt_inode_uses_fs_layer_crypto(inode) && nr_to_submit) { 513 + if (fscrypt_inode_uses_fs_layer_crypto(inode)) { 514 514 gfp_t gfp_flags = GFP_NOFS; 515 515 unsigned int enc_bytes = round_up(len, i_blocksize(inode)); 516 516 struct page *bounce_page;