All of lore.kernel.org
 help / color / mirror / Atom feed
From: piaojun <piaojun@huawei.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: virtio-fs@redhat.com
Subject: Re: [Virtio-fs] [PATCH v4 2/2] virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better performance
Date: Thu, 15 Aug 2019 09:11:49 +0800	[thread overview]
Message-ID: <5D54B155.90101@huawei.com> (raw)
In-Reply-To: <20190814125235.GC23970@stefanha-x1.localdomain>

Hi Stefan,

On 2019/8/14 20:52, Stefan Hajnoczi wrote:
> On Fri, Aug 09, 2019 at 08:53:20AM +0800, piaojun wrote:
>> diff --git a/contrib/virtiofsd/buffer.c b/contrib/virtiofsd/buffer.c
>> index cec762f..d127c45 100644
>> --- a/contrib/virtiofsd/buffer.c
>> +++ b/contrib/virtiofsd/buffer.c
>> @@ -318,11 +318,22 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
>>  ssize_t fuse_buf_copy(fuse_req_t req, struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
>>  		      enum fuse_buf_copy_flags flags)
>>  {
>> +	size_t i;
>>  	size_t copied = 0;
>>
>>  	if (dstv == srcv)
>>  		return fuse_buf_size(dstv);
>>
>> +	/* use writev to improve bandwidth when all the
>> +	 * src buffers already mapped by the daemon
>> +	 * process */
> 
> Some more checks to make this generic:
> 
>> +	for (i = 0; i < srcv->count; i++) {
>> +		if (srcv->buf[i].flags & FUSE_BUF_PHYS_ADDR)
>> +			break;
> 
>                 if (srcv->buf[i].flags & FUSE_BUF_IS_FD)
> 		        break;
> 
>> +	}
>> +	if (i == srcv->count)
> 
> Please verify the preconditions for the destination buffer too:
> 
>   && dstv->count == 1 && dstv->idx == 0 && dstv->off == 0 &&
>   (dstv->buf[0].flags & FUSE_BUF_IS_FD)

Thanks for your comments, and I prefer adding checker just for
FUSE_BUF_IS_FD as fuse_buf_writev() does not care much about the other
parts. And I personally think so many preconditions will make
fuse_buf_writev() so specific.

Thanks,
Jun

> 
>> +		return fuse_buf_writev(req, &dstv->buf[0], srcv);


  parent reply	other threads:[~2019-08-15  1:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09  0:50 [Virtio-fs] [PATCH v4 0/2] virtiofsd: Improve io bandwidth by replacing pwrite with pwritev piaojun
2019-08-09  0:51 ` [Virtio-fs] [PATCH v4 1/2] virtiofsd: add definition of fuse_buf_writev() piaojun
2019-08-14 17:07   ` Dr. David Alan Gilbert
2019-09-12  6:09     ` piaojun
2019-08-09  0:53 ` [Virtio-fs] [PATCH v4 2/2] virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better performance piaojun
2019-08-14 12:52   ` Stefan Hajnoczi
2019-08-14 13:28     ` piaojun
2019-08-15  1:11     ` piaojun [this message]
2019-08-15 14:50       ` Stefan Hajnoczi
2019-08-16  0:48         ` piaojun
2019-08-19 10:08           ` Stefan Hajnoczi
2019-08-11  2:06 ` [Virtio-fs] [PATCH v4 0/2] virtiofsd: Improve io bandwidth by replacing pwrite with pwritev Eric Ren
2019-08-11  2:46   ` piaojun
2019-08-11 11:15     ` Eric Ren
2019-08-11 13:55       ` piaojun
2019-08-14 12:41         ` Stefan Hajnoczi
2019-08-14  6:53 ` piaojun

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=5D54B155.90101@huawei.com \
    --to=piaojun@huawei.com \
    --cc=stefanha@redhat.com \
    --cc=virtio-fs@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.