RE: [PATCH v4 4/4] fs/proc/vmcore: Use iov_iter_count()

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

 



From: Baoquan He
> Sent: 18 March 2022 09:37
> 
> To replace open coded iter->count. This makes code cleaner.
...
> diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
> index 4cbb8db7c507..ed58a7edc821 100644
> --- a/fs/proc/vmcore.c
> +++ b/fs/proc/vmcore.c
> @@ -319,21 +319,21 @@ static ssize_t __read_vmcore(struct iov_iter *iter, loff_t *fpos)
>  	u64 start;
>  	struct vmcore *m = NULL;
> 
> -	if (iter->count == 0 || *fpos >= vmcore_size)
> +	if (!iov_iter_count(iter) || *fpos >= vmcore_size)

For some definition of 'cleaner' :-)

iter->count is clearly a simple, cheap structure member lookup.
OTOH iov_iter_count(iter) might be an expensive traversal of
the vector (or worse).

So a quick read of the code by someone who isn't an expert
in the iov functions leaves them wondering what is going on
or having to spend time locating the definition ...

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux