Re: [PATCH 3/3] target: use vfs_bvec_read/write

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

 



Hello,

On 1/18/15, Christoph Hellwig <hch@xxxxxx> wrote:
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  drivers/target/target_core_file.c | 29 ++++++++++++-----------------
>  1 file changed, 12 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/target/target_core_file.c
> b/drivers/target/target_core_file.c
> index d836de2..63ca7d5 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -331,36 +331,31 @@ static int fd_do_rw(struct se_cmd *cmd, struct
> scatterlist *sgl,
>  	struct fd_dev *dev = FD_DEV(se_dev);
>  	struct file *fd = dev->fd_file;
>  	struct scatterlist *sg;
> -	struct iovec *iov;
> -	mm_segment_t old_fs;
> +	struct bio_vec *bvec;
> +	ssize_t len = 0;
>  	loff_t pos = (cmd->t_task_lba * se_dev->dev_attrib.block_size);
>  	int ret = 0, i;
>
> -	iov = kzalloc(sizeof(struct iovec) * sgl_nents, GFP_KERNEL);
> -	if (!iov) {
> +	bvec = kzalloc(sizeof(struct bio_vec) * sgl_nents, GFP_KERNEL);
> +	if (!bvec) {
>  		pr_err("Unable to allocate fd_do_readv iov[]\n");
>  		return -ENOMEM;
>  	}
>
>  	for_each_sg(sgl, sg, sgl_nents, i) {
> -		iov[i].iov_len = sg->length;
> -		iov[i].iov_base = kmap(sg_page(sg)) + sg->offset;
> -	}
> +		bvec[i].bv_page = sg_page(sg);
> +		bvec[i].bv_len = sg->length;
> +		bvec[i].bv_offset = sg->offset;

Sorry, I have one question: I understand one bvec should only cover
one page, but
one sg may cover lots of pages, so could ITER_BVEC handle that correctly?

Thanks,
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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