Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp608126ybh; Wed, 11 Mar 2020 07:21:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvdQ9JqwRqGYdWhJInBfV11pXqCEmp2nu14vuIhRXUczk4MkP9Jf/CCiby+OESSjrTFtXlJ X-Received: by 2002:a4a:d6c7:: with SMTP id j7mr447339oot.10.1583936498753; Wed, 11 Mar 2020 07:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583936498; cv=none; d=google.com; s=arc-20160816; b=sAy2hMDvByx9F2CYJvqKg9GKPQm87ynaVVKYtiFXvWXtIb+B+uiQVyV83oGXVgLh/8 zi8h9NhuEJWtGaIpuj1gJGvqz5Wsa+9hE+rIUUStJlkjp8NyIONi5O1LsjEZXJNw9BTp HFamD9OOUEgv+iddvUGYwk/iM8opMq/+2ZXLcB3DunOBFHnz8qBUJe5VpnAgyfGW1Dv1 FVJQESLYATKsL/75xLomo1+LLkgpiGP3YahrO/6zphumTreFnxly8ZR8eRgViT0uc9Hc BQHWT9gnNSE0mP4P/Z98oP3d+2sZ1FNY0Tq0c0/7W5z6OuGAWjSxunZWJ290pxtlnDwc +QHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=69ujJbtlPdE8oHv4nVIHA9iuyZRWDdoY3VvgQ+IBL2s=; b=RdNhsf5qLesxai+7FjKX6aaQDyARS+112pfc0psOY9A8BUZK2377MsAEPcKcR3ObwB I89NZkMt9Tebil7pbuOmhCvD3Z5Y5Q8wmB0AUQ0yIvM33EgjHpWVq7tljtq2ZXws7oeQ OWwvcmWHMaRhW15SsKCmIXX7KXTVA9c5OjWtvjsCVL4eeCreetWVAKnndhqoid0TbnGB C/Y21oqfAKM92EKnGj5lagt0QrW/wRHvwmK2Aa6vcmzZPDvcunQ5X/KP6jAAy3Vt9DYh NIxdBADDDVTXvOBndZRtWxAnoTVZczycULTjF6pnHaHxPZe2dwh3F1mQx1BlBQV5moUE bp+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=cGM2MeQB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si25995otr.249.2020.03.11.07.21.16; Wed, 11 Mar 2020 07:21:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=cGM2MeQB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729853AbgCKOTa (ORCPT + 99 others); Wed, 11 Mar 2020 10:19:30 -0400 Received: from mail-il1-f195.google.com ([209.85.166.195]:33626 "EHLO mail-il1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729717AbgCKOTa (ORCPT ); Wed, 11 Mar 2020 10:19:30 -0400 Received: by mail-il1-f195.google.com with SMTP id k29so2171430ilg.0 for ; Wed, 11 Mar 2020 07:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=69ujJbtlPdE8oHv4nVIHA9iuyZRWDdoY3VvgQ+IBL2s=; b=cGM2MeQBmZSBuReLBU5d5sTRAoFDL2XQyMomBEOKrqeyIMkpsthwL9Qv2AhBzaksHC FZlfcVPmnf9pOrb3hqBmXEtqtUjv86fzG9yFxvtSAhUSNpTVjDmB73wbXrbIMMTcJZ9W zNerL5x3klshUWu2R6Mt6dC6OSXgWwOaqpPMg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=69ujJbtlPdE8oHv4nVIHA9iuyZRWDdoY3VvgQ+IBL2s=; b=RdaASdvHFfQPExfqCmA/1v2y6wB2umhXuWxD4lUqsQPw2sAjsQfVMfRpaadBPLWb4Q RJp5HsH6kpan43EabqvXBuOtWcuOPKHj/dgYcoPyKOFy84ZOLyQ9ufoSRhGSSyarJ4+r 0fLQ6Zwki+Ok/fl3ZyuFYA6xBQJ9vkzqdodw9p59sEKFiqqMOpnTAVkhYLdZwokcTEZ+ L/9196sdO7aMqent71X/Fob/8hikjQFSUXRsP4cVM0tktIcngHBX9y++/EDEBF1lkwzh yso0zBb80hqlPrle2mNFzTNwJqCu8Hmi2FoKj8Eb1UNHCf6DRfVofgbZ7OI6QpMBYPRi umRA== X-Gm-Message-State: ANhLgQ1xIO69NQmzg0Ylg/NN+yxvGrKMfyYFia/Q3KHtaW1U3A9svnfh G/eR9aSX+uhsq/U1P2G/mZkQ4mrm0bVEaGVtEADT6A== X-Received: by 2002:a92:d745:: with SMTP id e5mr3226635ilq.285.1583936369678; Wed, 11 Mar 2020 07:19:29 -0700 (PDT) MIME-Version: 1.0 References: <20200304165845.3081-1-vgoyal@redhat.com> <20200304165845.3081-13-vgoyal@redhat.com> <20200310203321.GF38440@redhat.com> In-Reply-To: From: Miklos Szeredi Date: Wed, 11 Mar 2020 15:19:18 +0100 Message-ID: Subject: Re: [PATCH 12/20] fuse: Introduce setupmapping/removemapping commands To: Amir Goldstein Cc: Vivek Goyal , linux-fsdevel , linux-kernel , linux-nvdimm , virtio-fs@redhat.com, Stefan Hajnoczi , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" , Peng Tao Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 11, 2020 at 8:03 AM Amir Goldstein wrote: > > On Tue, Mar 10, 2020 at 10:34 PM Vivek Goyal wrote: > > > > On Tue, Mar 10, 2020 at 08:49:49PM +0100, Miklos Szeredi wrote: > > > On Wed, Mar 4, 2020 at 5:59 PM Vivek Goyal wrote: > > > > > > > > Introduce two new fuse commands to setup/remove memory mappings. This > > > > will be used to setup/tear down file mapping in dax window. > > > > > > > > Signed-off-by: Vivek Goyal > > > > Signed-off-by: Peng Tao > > > > --- > > > > include/uapi/linux/fuse.h | 37 +++++++++++++++++++++++++++++++++++++ > > > > 1 file changed, 37 insertions(+) > > > > > > > > diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h > > > > index 5b85819e045f..62633555d547 100644 > > > > --- a/include/uapi/linux/fuse.h > > > > +++ b/include/uapi/linux/fuse.h > > > > @@ -894,4 +894,41 @@ struct fuse_copy_file_range_in { > > > > uint64_t flags; > > > > }; > > > > > > > > +#define FUSE_SETUPMAPPING_ENTRIES 8 > > > > +#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0) > > > > +struct fuse_setupmapping_in { > > > > + /* An already open handle */ > > > > + uint64_t fh; > > > > + /* Offset into the file to start the mapping */ > > > > + uint64_t foffset; > > > > + /* Length of mapping required */ > > > > + uint64_t len; > > > > + /* Flags, FUSE_SETUPMAPPING_FLAG_* */ > > > > + uint64_t flags; > > > > + /* Offset in Memory Window */ > > > > + uint64_t moffset; > > > > +}; > > > > + > > > > +struct fuse_setupmapping_out { > > > > + /* Offsets into the cache of mappings */ > > > > + uint64_t coffset[FUSE_SETUPMAPPING_ENTRIES]; > > > > + /* Lengths of each mapping */ > > > > + uint64_t len[FUSE_SETUPMAPPING_ENTRIES]; > > > > +}; > > > > > > fuse_setupmapping_out together with FUSE_SETUPMAPPING_ENTRIES seem to be unused. > > > > This looks like leftover from the old code. I will get rid of it. Thanks. > > > > Hmm. I wonder if we should keep some out args for future extensions. > Maybe return the mapped size even though it is all or nothing at this > point? > > I have interest in a similar FUSE mapping functionality that was prototyped > by Miklos and published here: > https://lore.kernel.org/linux-fsdevel/CAJfpegtjEoE7H8tayLaQHG9fRSBiVuaspnmPr2oQiOZXVB1+7g@mail.gmail.com/ > > In this prototype, a FUSE_MAP command is used by the server to map a > range of file to the kernel for io. The command in args are quite similar to > those in fuse_setupmapping_in, but since the server is on the same host, > the mapping response is {mapfd, offset, size}. Right. So the difference is in which entity allocates the mapping. IOW whether the {fd, offset, size} is input or output in the protocol. I don't remember the reasons for going with the mapping being allocated by the client, not the other way round. Vivek? If the allocation were to be by the server, we could share the request type and possibly some code between the two, although the I/O mechanism would still be different. Thanks, Miklos