All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: remove unneeded check of nr_to_submit
@ 2023-03-16 20:48 Tom Rix
  2023-03-17  4:58 ` Eric Biggers
  2023-04-20 13:47 ` Theodore Ts'o
  0 siblings, 2 replies; 4+ messages in thread
From: Tom Rix @ 2023-03-16 20:48 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, Tom Rix

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>
---
 fs/ext4/page-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 8703fd732abb..b847131bc958 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -513,7 +513,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
 	 * (e.g. holes) to be unnecessarily encrypted, but this is rare and
 	 * can't happen in the common case of blocksize == PAGE_SIZE.
 	 */
-	if (fscrypt_inode_uses_fs_layer_crypto(inode) && nr_to_submit) {
+	if (fscrypt_inode_uses_fs_layer_crypto(inode)) {
 		gfp_t gfp_flags = GFP_NOFS;
 		unsigned int enc_bytes = round_up(len, i_blocksize(inode));
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: remove unneeded check of nr_to_submit
  2023-03-16 20:48 [PATCH] ext4: remove unneeded check of nr_to_submit Tom Rix
@ 2023-03-17  4:58 ` Eric Biggers
  2023-03-17 11:08   ` Tom Rix
  2023-04-20 13:47 ` Theodore Ts'o
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2023-03-17  4:58 UTC (permalink / raw)
  To: Tom Rix; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel

On Thu, Mar 16, 2023 at 04:48:31PM -0400, Tom Rix wrote:
> 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>

Maybe add:

Fixes: dff4ac75eeee ("ext4: move keep_towrite handling to ext4_bio_write_page()")

Either way, looks good to me.

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: remove unneeded check of nr_to_submit
  2023-03-17  4:58 ` Eric Biggers
@ 2023-03-17 11:08   ` Tom Rix
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rix @ 2023-03-17 11:08 UTC (permalink / raw)
  To: Eric Biggers; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel


On 3/16/23 9:58 PM, Eric Biggers wrote:
> On Thu, Mar 16, 2023 at 04:48:31PM -0400, Tom Rix wrote:
>> 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>
> Maybe add:
>
> Fixes: dff4ac75eeee ("ext4: move keep_towrite handling to ext4_bio_write_page()")

The rule of thumb I use is 'would this require a recompile?'

In this case, the existing code will work, so no fixes:

Tom

> Either way, looks good to me.
>
> Reviewed-by: Eric Biggers <ebiggers@google.com>
>
> - Eric
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4: remove unneeded check of nr_to_submit
  2023-03-16 20:48 [PATCH] ext4: remove unneeded check of nr_to_submit Tom Rix
  2023-03-17  4:58 ` Eric Biggers
@ 2023-04-20 13:47 ` Theodore Ts'o
  1 sibling, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2023-04-20 13:47 UTC (permalink / raw)
  To: adilger.kernel, Tom Rix; +Cc: Theodore Ts'o, linux-ext4, linux-kernel


On Thu, 16 Mar 2023 16:48:31 -0400, Tom Rix wrote:
> 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;
> 
> [...]

Applied, thanks!

[1/1] ext4: remove unneeded check of nr_to_submit
      commit: 8ae56b4e82ee29b5cc1fbea8b00a0a7e0758f3c2

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-20 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 20:48 [PATCH] ext4: remove unneeded check of nr_to_submit Tom Rix
2023-03-17  4:58 ` Eric Biggers
2023-03-17 11:08   ` Tom Rix
2023-04-20 13:47 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.