From nobody Mon Feb 9 21:19:01 2026 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFFEA399029 for ; Wed, 7 Jan 2026 15:35:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767800104; cv=none; b=k1sNtzClqh4sTeOF5pIL+j5uSvk1p60WOROmfuoh7DnKYNNgwXQzCBF6RyyPM4X9Weu/ChDWPkgOrPYYBf3JUZX3ymoTuuSJA+z3bshRNkWIutGWnpPz10z+K1YOIbMEZ1O152tAlx4y61RATqA3aeCXmb31fzabpF4hfkBD/h4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767800104; c=relaxed/simple; bh=HM4lKamXQwEUZnRqp2/mgy4o0pjN0zbCyAQ9KEkrnNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZuXhDV0ccsiBAiYx1NONQ7GXrAlIIUpSNGPBXO8fZ9WaqQn1TKavRtoZddh9lUsrNd2XFzdG+iGT1b33hOer943hQPC792ysxzRt/JOEBUM+6m6cBlA1a003HxddGigHpUdFOWCebWxjB4uT8RpWggOJs4416UxCt0wSCzchM9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=Groves.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TBfRge6Z; arc=none smtp.client-ip=209.85.167.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=Groves.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TBfRge6Z" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-450c65f3510so1427939b6e.2 for ; Wed, 07 Jan 2026 07:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767800099; x=1768404899; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=OPrNuirfi0NELPHMFcu/1KlJClDuCwOT8DJm2N/JJag=; b=TBfRge6ZoGYJNVe+MfO7B8Q/lEdSD76bj1t7mMM11HcoqkehMf7mYPh6Br09hLbmwh y5aMVudtDQjn9njNFVyKm4KX8K6HPC9G1m2LTLxOTYg8eCLtKE4p/qAEEvo6YzWRuHtW NdwWCLBC+PnDiHoahfPE0Kdc3e9EZRSWIiFGx1np9Vwxfs5x5NQ53vKDhtG4cWTXjTXR Cl+zwf/ufAj5/JpjyWYyyz7eH3pOHbDEAX3WCpWYztlP6NXg3E7CujM3RMhrebI/iWts kIwDZ3OB6Z32qnSp4QVo8SUwFMQ31YEstNwTC/Fc7lpl/JGrYHY3yx4MA72PakPxGF9S wIDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767800099; x=1768404899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OPrNuirfi0NELPHMFcu/1KlJClDuCwOT8DJm2N/JJag=; b=irXFR5SnKch3lEDm1ZxeX5o/8ex0pWrAlvECJoxLzyhDzCAkYaLjhvhkQHt5YDZjCL C3RUdO+B+Z+09oSydQZ6L/Lm/dQiFT8mMYSjK2aW7VWfVLdTSO2h3fLFqu2dBJ8FdXqP HAG9G7giS6XdKfzKR0XAVpB1IE2ojCnC9T/AC0fQRLTO/dRHMzyCjnrDXpHhwje9Nm6X 1C6FjUppJyCrUNTizg80U36aHoOMKMYcGnd3GLejCvyEsAF0QuUF52W4zP+DQh2LU+VU n8YzNnLu5I1+rUM2nL2rwoYCWte2qUkmo4/VghYiKDkkAP/dvcXRvMd+xzXFaFC7Ep7k DR8w== X-Forwarded-Encrypted: i=1; AJvYcCX77WtiUMCTQ9yyVqsEfCoAfIt+RAyLGUMsVhFNTRZPoxjcZRoKaeFZGODyvwEvCmF7cfdNGw1NTTsNElk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4nrbQcvNhkEw5Z7JnrEc+yUxj4fHyyoam7d7BJba1L+Lnbf3n pv1z2LlabhnhAlW3UR3sMn8ApAf1w/5OPxVoIVRS17EPsC7tJ1yNBl1d X-Gm-Gg: AY/fxX5gza6y/6hVs9yrhxW641uoiQIPpBErHIG7CCxJyKvT79DwIlh5aDNjjouODq/ aukxnF/P6LFA0kQRSMknUgP8RXVgePrlomir1kMs/Py+Xz1GpqX6mZJ6i0PDJIvIvxBQLcLOUzI wo6HhX7UNpzjwRsFxJMvm+iyOUcMPGNmHcrr3b5qbUgHSBaQo6C2wFVx09TCASj/SybTdbin9ua UAIauSg8zDf30vnhrC46ZPVemNXlRfDCJ1B8tLJL+TBVwCw4J6CJpmdgIxaK4HDHrh5YjdcAauL pziy3hjzz+2kFuysIknpeI6wBnyRfQ9t+di+6F+4A98A4hewi5wSrdrtzWgkUuz0YTMaL/l6snO 20Km4pnOWFf02RcE+7kvcLXoXlF0vEQel2sX6nK1WAyavksIYFjbnTYa+UIqfJuH6HCEv4Y66Mr mDbVIvJJ1sSk12D6jwHXcrF27SWO7BTOWChxccbMXICCvt X-Google-Smtp-Source: AGHT+IFUAwqlKPFZxOP8hKjN3yWWiewXwLTUZV8MqKGeOfhFctvOkPQ3NvPc2aDZQl4je/LWLvX3LQ== X-Received: by 2002:a05:6808:3206:b0:450:c877:fd6f with SMTP id 5614622812f47-45a6befa901mr1333720b6e.67.1767800099405; Wed, 07 Jan 2026 07:34:59 -0800 (PST) Received: from localhost.localdomain ([2603:8080:1500:3d89:a917:5124:7300:7cef]) by smtp.gmail.com with ESMTPSA id 5614622812f47-45a5e183ac3sm2398424b6e.4.2026.01.07.07.34.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 07 Jan 2026 07:34:59 -0800 (PST) Sender: John Groves From: John Groves X-Google-Original-From: John Groves To: John Groves , Miklos Szeredi , Dan Williams , Bernd Schubert , Alison Schofield Cc: John Groves , Jonathan Corbet , Vishal Verma , Dave Jiang , Matthew Wilcox , Jan Kara , Alexander Viro , David Hildenbrand , Christian Brauner , "Darrick J . Wong" , Randy Dunlap , Jeff Layton , Amir Goldstein , Jonathan Cameron , Stefan Hajnoczi , Joanne Koong , Josef Bacik , Bagas Sanjaya , Chen Linxuan , James Morse , Fuad Tabba , Sean Christopherson , Shivank Garg , Ackerley Tng , Gregory Price , Aravind Ramesh , Ajay Joshi , venkataravis@micron.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, John Groves Subject: [PATCH V3 4/4] fuse: add famfs DAX fmap support Date: Wed, 7 Jan 2026 09:34:43 -0600 Message-ID: <20260107153443.64794-5-john@groves.net> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260107153443.64794-1-john@groves.net> References: <20260107153244.64703-1-john@groves.net> <20260107153443.64794-1-john@groves.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add new FUSE operations and capability for famfs DAX file mapping: - FUSE_CAP_DAX_FMAP: New capability flag at bit 32 (using want_ext/capable_= ext fields) to indicate kernel and userspace support for DAX fmaps - GET_FMAP: New operation to retrieve a file map for DAX-mapped files. Returns a fuse_famfs_fmap_header followed by simple or interleaved extent descriptors. The kernel passes the file size as an argument. - GET_DAXDEV: New operation to retrieve DAX device info by index. Called when GET_FMAP returns an fmap referencing a previously unknown DAX device. These operations enable FUSE filesystems to provide direct access mappings to persistent memory, allowing the kernel to map files directly to DAX devices without page cache intermediation. Signed-off-by: John Groves --- include/fuse_common.h | 5 +++++ include/fuse_lowlevel.h | 37 +++++++++++++++++++++++++++++++++++++ lib/fuse_lowlevel.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/include/fuse_common.h b/include/fuse_common.h index 041188e..e428ddb 100644 --- a/include/fuse_common.h +++ b/include/fuse_common.h @@ -512,6 +512,11 @@ struct fuse_loop_config_v1 { */ #define FUSE_CAP_OVER_IO_URING (1UL << 31) =20 +/** + * handle files that use famfs dax fmaps + */ +#define FUSE_CAP_DAX_FMAP (1UL<<32) + /** * Ioctl flags * diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index d2bbcca..55fcfd7 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -1341,6 +1341,43 @@ struct fuse_lowlevel_ops { */ void (*statx)(fuse_req_t req, fuse_ino_t ino, int flags, int mask, struct fuse_file_info *fi); + + /** + * Get a famfs/devdax/fsdax fmap + * + * Retrieve a file map (aka fmap) for a previously looked-up file. + * The fmap is serialized into the buffer, anchored by + * struct fuse_famfs_fmap_header, followed by one or more + * structs fuse_famfs_simple_ext, or fuse_famfs_iext (which itself + * is followed by one or more fuse_famfs_simple_ext... + * + * Valid replies: + * fuse_reply_buf (TODO: variable-size reply) + * fuse_reply_err + * + * @param req request handle + * @param ino the inode number + */ + void (*get_fmap) (fuse_req_t req, fuse_ino_t ino, size_t size); + + /** + * Get a daxdev by index + * + * Retrieve info on a daxdev by index. This will be called any time + * GET_FMAP has returned a file map that references a previously + * unused daxdev. struct famfs_simple_ext, which is used for all + * resolutions to daxdev offsets, references daxdevs by index. + * In user space we maintain a master list of all referenced daxdevs + * by index, which is queried by get_daxdev. + * + * Valid replies: + * fuse_reply_buf + * fuse_reply_err + * + * @param req request handle + * @param ino the index of the daxdev + */ + void (*get_daxdev) (fuse_req_t req, int daxdev_index); }; =20 /** diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 413e7c3..c3adfa2 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2769,7 +2769,8 @@ _do_init(fuse_req_t req, const fuse_ino_t nodeid, con= st void *op_in, se->conn.capable_ext |=3D FUSE_CAP_NO_EXPORT_SUPPORT; if (inargflags & FUSE_OVER_IO_URING) se->conn.capable_ext |=3D FUSE_CAP_OVER_IO_URING; - + if (inargflags & FUSE_DAX_FMAP) + se->conn.capable_ext |=3D FUSE_CAP_DAX_FMAP; } else { se->conn.max_readahead =3D 0; } @@ -2932,6 +2933,8 @@ _do_init(fuse_req_t req, const fuse_ino_t nodeid, con= st void *op_in, outargflags |=3D FUSE_REQUEST_TIMEOUT; outarg.request_timeout =3D se->conn.request_timeout; } + if (se->conn.want_ext & FUSE_CAP_DAX_FMAP) + outargflags |=3D FUSE_DAX_FMAP; =20 outarg.max_readahead =3D se->conn.max_readahead; outarg.max_write =3D se->conn.max_write; @@ -3035,6 +3038,30 @@ static void do_destroy(fuse_req_t req, fuse_ino_t no= deid, const void *inarg) _do_destroy(req, nodeid, inarg, NULL); } =20 +static void +do_get_fmap(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) +{ + struct fuse_session *se =3D req->se; + struct fuse_getxattr_in *arg =3D (struct fuse_getxattr_in *) inarg; + + if (se->op.get_fmap) + se->op.get_fmap(req, nodeid, arg->size); + else + fuse_reply_err(req, -EOPNOTSUPP); +} + +static void +do_get_daxdev(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) +{ + struct fuse_session *se =3D req->se; + (void)inarg; + + if (se->op.get_daxdev) + se->op.get_daxdev(req, nodeid); /* Use nodeid as daxdev_index */ + else + fuse_reply_err(req, -EOPNOTSUPP); +} + static void list_del_nreq(struct fuse_notify_req *nreq) { struct fuse_notify_req *prev =3D nreq->prev; @@ -3470,6 +3497,8 @@ static struct { [FUSE_LSEEK] =3D { do_lseek, "LSEEK" }, [FUSE_STATX] =3D { do_statx, "STATX" }, [CUSE_INIT] =3D { cuse_lowlevel_init, "CUSE_INIT" }, + [FUSE_GET_FMAP] =3D { do_get_fmap, "GET_FMAP" }, + [FUSE_GET_DAXDEV] =3D { do_get_daxdev, "GET_DAXDEV" }, }; =20 static struct { --=20 2.49.0