Re: [PATCH] fs/pipe.c: merge if statements with identical conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 07 2025, Mateusz Guzik <mjguzik@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxx>
>> ---
>>  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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux