[Devel] Re: [PATCH 07/11] fuse: add per-page descriptor <offset, length> to fuse_req (v2)

Maxim V. Patlasov mpatlasov at parallels.com
Thu Oct 25 06:39:21 PDT 2012


Hi,

10/25/2012 05:24 PM, Miklos Szeredi пишет:
> Maxim Patlasov <mpatlasov at parallels.com> writes:
>
>> The ability to save page pointers along with lengths and offsets in fuse_req
>> will be useful to cover several iovec-s with a single fuse_req.
>>
>> Per-request page_offset is removed because anybody who need it can use
>> req->page_descs[0].offset instead.
>>
>> Changed in v2:
>>   - replaced structure page_desc with fuse_page_desc
>>
>> Signed-off-by: Maxim Patlasov <mpatlasov at parallels.com>
>> ---
>>   fs/fuse/dev.c    |   26 +++++++++++++++++++-------
>>   fs/fuse/file.c   |   10 +++++-----
>>   fs/fuse/fuse_i.h |   15 ++++++++++++---
>>   3 files changed, 36 insertions(+), 15 deletions(-)
>>
>> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
>> index b241a7d..72ad962 100644
>> --- a/fs/fuse/dev.c
>> +++ b/fs/fuse/dev.c
>> @@ -35,14 +35,17 @@ static struct fuse_conn *fuse_get_conn(struct file *file)
>>   }
>>   
>>   static void fuse_request_init(struct fuse_req *req, struct page **pages,
>> +			      struct fuse_page_desc *page_descs,
>>   			      unsigned npages)
>>   {
>>   	memset(req, 0, sizeof(*req));
>> +	memset(page_descs, 0, sizeof(*page_descs) * npages);
> Makes me wonder:  why aren't we zeroing out the page array too?

Good catch, thnx! This is a legacy since time when I attempted to use 
<page, length, offset> as fuse_page_desc. Now, when we have both 
page_descs[] and pages[], it's natural to zero both.

>
> @@ -82,6 +92,8 @@ void fuse_request_free(struct fuse_req *req)
>   {
>   	if (req->pages != req->inline_pages)
>   		kfree(req->pages);
> +	if (req->page_descs != req->inline_page_descs)
> +		kfree(req->page_descs);
> You allocate them together, you can free them together.  Just add a
> BUG_ON() if you feel paranoid.

OK.

Thanks,
Maxim




More information about the Devel mailing list