Re: [PATCH 1/4] iov_iter: Provide copy_iomem_to|from_iter()

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

 



On Thu, Nov 07, 2024 at 05:34:45PM +0100, Michal Wajdeczko wrote:
> +size_t copy_iomem_to_iter(const void __iomem *from, size_t offset,
> +			  size_t bytes, struct iov_iter *i)
> +{
> +	unsigned char buf[SMP_CACHE_BYTES];
> +	size_t progress = 0, copied, len;
> +
> +	from += offset;
> +	while (bytes) {
> +		len = min(bytes, sizeof(buf));
> +		memcpy_fromio(buf, from + progress, len);
> +		copied = _copy_to_iter(buf, len, i);
> +		if (!copied)
> +			break;
> +		bytes -= copied;
> +		progress += copied;
> +	}

This seems like a rather sad implementation.  Why not:

	if (WARN_ON_ONCE(i->data_source))
		return 0;
	if (user_backed_iter(i))
		might_fault();
	return iterate_and_advance(i, bytes, (void *)addr,
			copy_iomem_to_iter, memcpy_iomem_to_iter);

along with

size_t memcpy_iomem_to_iter()
{
	memcpy_fromio(iter_to, from + progress, len);
	return 0;
}`




[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