public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	 David Howells <dhowells@redhat.com>,
	 Oleg Nesterov <oleg@redhat.com>,  Jan Kara <jack@suse.cz>,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/pipe.c: merge if statements with identical conditions
Date: Fri, 07 Mar 2025 23:51:41 +0100	[thread overview]
Message-ID: <87frjo4fpe.fsf@prevas.dk> (raw)
In-Reply-To: <wkdxihiolxnzelu57llc7vealuofie3l42clbsn7tqjbvstxqp@a6d74rhrvcla> (Mateusz Guzik's message of "Fri, 7 Mar 2025 23:40:54 +0100")

On Fri, Mar 07 2025, Mateusz Guzik <mjguzik@gmail.com> wrote:

> On Fri, Mar 07, 2025 at 11:25:00PM +0100, Rasmus Villemoes wrote:
>> As 'head' is not updated after head+1 is assigned to pipe->head, the
>> condition being tested here is exactly the same as in the big if
>> statement just above. Merge the two bodies.
>> 
>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>> ---
>>  fs/pipe.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>> diff --git a/fs/pipe.c b/fs/pipe.c
>> index 097400cce241..27385e3e5417 100644
>> --- a/fs/pipe.c
>> +++ b/fs/pipe.c
>> @@ -547,10 +547,8 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
>>  
>>  			if (!iov_iter_count(from))
>>  				break;
>> -		}
>> -
>> -		if (!pipe_full(head, pipe->tail, pipe->max_usage))
>>  			continue;
>> +		}
>>  
>>  		/* Wait for buffer space to become available. */
>>  		if ((filp->f_flags & O_NONBLOCK) ||
>
> I already posted this :)
>

Ah, never mind then, also for that other patch I just sent. Just
stumbled on those while trying to proof-read the pipe code.

Rasmus

  reply	other threads:[~2025-03-07 22:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 22:25 [PATCH] fs/pipe.c: merge if statements with identical conditions Rasmus Villemoes
2025-03-07 22:40 ` Mateusz Guzik
2025-03-07 22:51   ` Rasmus Villemoes [this message]
2025-03-07 22:54 ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87frjo4fpe.fsf@prevas.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=dhowells@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --cc=oleg@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox