Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230312/?format=api
{ "id": 2230312, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230312/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/177747214821.4107473.4235956386247228859.stgit@frogsfrogsfrogs/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.1/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<177747214821.4107473.4235956386247228859.stgit@frogsfrogsfrogs>", "date": "2026-04-29T14:56:48", "name": "[16/19] fuse2fs: implement statx", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "dd9c2362b0367c62126fb465f7e578d9c8a901d3", "submitter": { "id": 77032, "url": "http://patchwork.ozlabs.org/api/1.1/people/77032/?format=api", "name": "Darrick J. Wong", "email": "djwong@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/177747214821.4107473.4235956386247228859.stgit@frogsfrogsfrogs/mbox/", "series": [ { "id": 502087, "url": "http://patchwork.ozlabs.org/api/1.1/series/502087/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=502087", "date": "2026-04-29T14:53:09", "name": "[01/19] fuse2fs: implement bare minimum iomap for file mapping reporting", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502087/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230312/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230312/checks/", "tags": {}, "headers": { "Return-Path": "\n <SRS0=Ntnf=C4=vger.kernel.org=linux-ext4+bounces-16205-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ext4@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=BV5DCw3l;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=ntnf=c4=vger.kernel.org=linux-ext4+bounces-16205-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c04:e001:36c::12fc:5321\"\n arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=BV5DCw3l;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16205-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"BV5DCw3l\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5L5V4T1Yz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 00:58:06 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g5L5V3zQ4z4wM1\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 00:58:06 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4g5L5V3tfyz4wLR; Thu, 30 Apr 2026 00:58:06 +1000 (AEST)", "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g5L5Q6z2fz4wM1\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 30 Apr 2026 00:58:02 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 44957301385B\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 29 Apr 2026 14:56:52 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 26A9A3382C7;\n\tWed, 29 Apr 2026 14:56:49 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id DDC7730DEB2;\n\tWed, 29 Apr 2026 14:56:48 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 7A3EEC2BCB8;\n\tWed, 29 Apr 2026 14:56:48 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777474686; cv=pass;\n\tb=vIKQ/+9Z9EwKhixAjGb8dKZnQoc2Zgz9OVZ9VizVbE4gmrL8JHbdt42J8/SKY0InFdG7seDP7HaZdVh+U3LXlbysvyoiynLH//gM+nCSKiuL7G73Us3WjUZKnUe94T/2e3kHGcHjudoBhnSAySCNjT4pxZ5eJxBzl1zShUVEqWamyEDQCGhNj6DNNHFFQJSHu27jOTQc0JJessZXZSzT62TnltIEPQ7RiovayXHZjDI7/TzHOoIdSqNARM48ZzIg29uvoWq1z8CszaB7gMXqpZyQcyObmS+Zi/0FB2pNKhWys5dlnJ2bl3YkrOo09dqJj9/vDF6zEJGLOG+pGQ9r9Q==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777474608; cv=none;\n b=DR7V8T+yyv0dUaJEJgPktOvB59RlUCrPGMW9FDTsj8J7cGeh9lc6ufZtxT1097vpH3DhMkc91N+iSKaNwol/9d+yY4KgyeQswlqASHXXhCyMvrUvveelw74S4uhRKxBQb/TFGxTvKANG2LvTwEzjPiQvzVYYJdtfd5n08F5FALk=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777474686; c=relaxed/relaxed;\n\tbh=2cgPFJLNBWeByXy4J0BxsbWoUQ886M0L7TCziN+2EYY=;\n\th=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=UKIy56CkkmzDP61qmPVaS6aD3cdLgCNzI83lpkbOoERdor2g8DZqkhr5kL4jhEPiZPWe6kIY8+EChPhDFYxgywZ47ibT0jLtqNVz4gioZetsGCDTjVNdcVZvOUZnfOJQP3U0muqvVtqTbNwhvR/vpWt9ZQCdj6UtU8y3rCqmfgCgWwvH4Apjp2c2T1Oxvz5fKc/vTUe69E8xc7nhAZLr9jt1QsRLRynbav3mSv8Bx28Ydy5EiAI7k5/NO0SWY4dztLI8RH+V9uAFJvwp+S3WueTkJG5uSgHzpdz/RnagX1lvbXgFTWg6v1ChEzOJcpEYEZLGcgejVzxyce1NrepLNA==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777474608; c=relaxed/simple;\n\tbh=L7nT/BDeizWvsJxivEyqjB6WwbDg63LrX95DTnPrtYI=;\n\th=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=X4benQ93Rmhizy3yqfPjDAKupC+0SOw4Jq22XesTvZpZPu14sHfBYRdpx10rLmPTJmzqdsoV6YvYlQ8WlIb5MyboSM5M4BzFiuypAyDBlg8vVpgdfEf6iQEg6luCeMy5z64AJzdoRpaVQZ5N6WVnodPxXJRoZXU6TDK6zZ07Agg=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=BV5DCw3l; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16205-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=BV5DCw3l; arc=none smtp.client-ip=10.30.226.201" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777474608;\n\tbh=L7nT/BDeizWvsJxivEyqjB6WwbDg63LrX95DTnPrtYI=;\n\th=Date:Subject:From:To:Cc:In-Reply-To:References:From;\n\tb=BV5DCw3lb5qF/GKc+noc3nCJnFGWR2LVvfg4m6kHejkK0mhdgaAr1M+7y7uuqT+Cs\n\t s3bE+UETZ65bGS0al1bsN5e1Jy0WliXeuP2S8atlEQF4o1TE5O02TkOvXpWVPKZOP7\n\t VGojvmdD6gHia9VpJFI+ekABACCiYpxzK0RIaYHMV6/Z9gx55/HK9Lm0DgC8dDdwIY\n\t /0bzzsINVFaNy3oLPXN40cgsgw+V3nAi0089+VtoFyEHKVwVZbjuC/1SmTaAVR2xBH\n\t G4go+ORu4R1viJ4ADU/jgG23y17gxPsw2BUKHNZ/3HJ8oOsuuixOeIhUjai2Ve+L6F\n\t 0e0x+wnw2PuZQ==", "Date": "Wed, 29 Apr 2026 07:56:48 -0700", "Subject": "[PATCH 16/19] fuse2fs: implement statx", "From": "\"Darrick J. Wong\" <djwong@kernel.org>", "To": "tytso@mit.edu", "Cc": "bernd@bsbernd.com, miklos@szeredi.hu, linux-ext4@vger.kernel.org,\n neal@gompa.dev, linux-fsdevel@vger.kernel.org, fuse-devel@lists.linux.dev,\n joannelkoong@gmail.com", "Message-ID": "<177747214821.4107473.4235956386247228859.stgit@frogsfrogsfrogs>", "In-Reply-To": "<177747214459.4107473.9520724883867588970.stgit@frogsfrogsfrogs>", "References": "<177747214459.4107473.9520724883867588970.stgit@frogsfrogsfrogs>", "Precedence": "bulk", "X-Mailing-List": "linux-ext4@vger.kernel.org", "List-Id": "<linux-ext4.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "From: Darrick J. Wong <djwong@kernel.org>\n\nImplement statx.\n\nSigned-off-by: \"Darrick J. Wong\" <djwong@kernel.org>\n---\n fuse4fs/fuse4fs.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n misc/fuse2fs.c | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 267 insertions(+)", "diff": "diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c\nindex 6016e23c511ac1..8d994fe490e914 100644\n--- a/fuse4fs/fuse4fs.c\n+++ b/fuse4fs/fuse4fs.c\n@@ -24,6 +24,7 @@\n #include <sys/xattr.h>\n #endif\n #include <sys/ioctl.h>\n+#include <sys/sysmacros.h>\n #include <unistd.h>\n #include <ctype.h>\n #include <assert.h>\n@@ -2411,6 +2412,138 @@ static void op_getattr(fuse_req_t req, fuse_ino_t fino,\n \t\t\t\t fstat.entry.attr_timeout);\n }\n \n+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 18) && defined(STATX_BASIC_STATS)\n+static inline void fuse4fs_set_statx_attr(struct statx *stx,\n+\t\t\t\t\t uint64_t statx_flag, int set)\n+{\n+\tif (set)\n+\t\tstx->stx_attributes |= statx_flag;\n+\tstx->stx_attributes_mask |= statx_flag;\n+}\n+\n+static void fuse4fs_statx_directio(struct fuse4fs *ff, struct statx *stx)\n+{\n+\tstruct statx devx;\n+\terrcode_t err;\n+\tint fd;\n+\n+\terr = io_channel_get_fd(ff->fs->io, &fd);\n+\tif (err)\n+\t\treturn;\n+\n+\terr = statx(fd, \"\", AT_EMPTY_PATH, STATX_DIOALIGN, &devx);\n+\tif (err)\n+\t\treturn;\n+\tif (!(devx.stx_mask & STATX_DIOALIGN))\n+\t\treturn;\n+\n+\tstx->stx_mask |= STATX_DIOALIGN;\n+\tstx->stx_dio_mem_align = devx.stx_dio_mem_align;\n+\tstx->stx_dio_offset_align = devx.stx_dio_offset_align;\n+}\n+\n+static int fuse4fs_statx(struct fuse4fs *ff, ext2_ino_t ino, int statx_mask,\n+\t\t\t struct statx *stx)\n+{\n+\tstruct ext2_inode_large inode;\n+\text2_filsys fs = ff->fs;;\n+\tdev_t fakedev = 0;\n+\terrcode_t err;\n+\tstruct timespec tv;\n+\n+\terr = fuse4fs_read_inode(fs, ino, &inode);\n+\tif (err)\n+\t\treturn translate_error(fs, ino, err);\n+\n+\tmemcpy(&fakedev, fs->super->s_uuid, sizeof(fakedev));\n+\tstx->stx_mask = STATX_BASIC_STATS;\n+\tstx->stx_dev_major = major(fakedev);\n+\tstx->stx_dev_minor = minor(fakedev);\n+\tstx->stx_ino = ino;\n+\tstx->stx_mode = inode.i_mode;\n+\tstx->stx_nlink = inode.i_links_count;\n+\tstx->stx_uid = inode_uid(inode);\n+\tstx->stx_gid = inode_gid(inode);\n+\tstx->stx_size = EXT2_I_SIZE(&inode);\n+\tstx->stx_blksize = fs->blocksize;\n+\tstx->stx_blocks = ext2fs_get_stat_i_blocks(fs,\n+\t\t\t\t\t\tEXT2_INODE(&inode));\n+\tEXT4_INODE_GET_XTIME(i_atime, &tv, &inode);\n+\tstx->stx_atime.tv_sec = tv.tv_sec;\n+\tstx->stx_atime.tv_nsec = tv.tv_nsec;\n+\n+\tEXT4_INODE_GET_XTIME(i_mtime, &tv, &inode);\n+\tstx->stx_mtime.tv_sec = tv.tv_sec;\n+\tstx->stx_mtime.tv_nsec = tv.tv_nsec;\n+\n+\tEXT4_INODE_GET_XTIME(i_ctime, &tv, &inode);\n+\tstx->stx_ctime.tv_sec = tv.tv_sec;\n+\tstx->stx_ctime.tv_nsec = tv.tv_nsec;\n+\n+\tif (EXT4_FITS_IN_INODE(&inode, i_crtime)) {\n+\t\tstx->stx_mask |= STATX_BTIME;\n+\t\tEXT4_INODE_GET_XTIME(i_crtime, &tv, &inode);\n+\t\tstx->stx_btime.tv_sec = tv.tv_sec;\n+\t\tstx->stx_btime.tv_nsec = tv.tv_nsec;\n+\t}\n+\n+\tdbg_printf(ff, \"%s: ino=%d atime=%lld.%d mtime=%lld.%d ctime=%lld.%d btime=%lld.%d\\n\",\n+\t\t __func__, ino,\n+\t\t (long long int)stx->stx_atime.tv_sec, stx->stx_atime.tv_nsec,\n+\t\t (long long int)stx->stx_mtime.tv_sec, stx->stx_mtime.tv_nsec,\n+\t\t (long long int)stx->stx_ctime.tv_sec, stx->stx_ctime.tv_nsec,\n+\t\t (long long int)stx->stx_btime.tv_sec, stx->stx_btime.tv_nsec);\n+\n+\tif (LINUX_S_ISCHR(inode.i_mode) ||\n+\t LINUX_S_ISBLK(inode.i_mode)) {\n+\t\tif (inode.i_block[0]) {\n+\t\t\tstx->stx_rdev_major = major(inode.i_block[0]);\n+\t\t\tstx->stx_rdev_minor = minor(inode.i_block[0]);\n+\t\t} else {\n+\t\t\tstx->stx_rdev_major = major(inode.i_block[1]);\n+\t\t\tstx->stx_rdev_minor = minor(inode.i_block[1]);\n+\t\t}\n+\t}\n+\n+\tfuse4fs_set_statx_attr(stx, STATX_ATTR_COMPRESSED,\n+\t\t\t inode.i_flags & EXT2_COMPR_FL);\n+\tfuse4fs_set_statx_attr(stx, STATX_ATTR_IMMUTABLE,\n+\t\t\t inode.i_flags & EXT2_IMMUTABLE_FL);\n+\tfuse4fs_set_statx_attr(stx, STATX_ATTR_APPEND,\n+\t\t\t inode.i_flags & EXT2_APPEND_FL);\n+\tfuse4fs_set_statx_attr(stx, STATX_ATTR_NODUMP,\n+\t\t\t inode.i_flags & EXT2_NODUMP_FL);\n+\n+\tfuse4fs_statx_directio(ff, stx);\n+\n+\treturn 0;\n+}\n+\n+static void op_statx(fuse_req_t req, fuse_ino_t fino, int flags, int mask,\n+\t\t struct fuse_file_info *fi)\n+{\n+\tstruct statx stx = { };\n+\tstruct fuse4fs *ff = fuse4fs_get(req);\n+\text2_ino_t ino;\n+\tint ret = 0;\n+\n+\tFUSE4FS_CHECK_CONTEXT(req);\n+\tFUSE4FS_CONVERT_FINO(req, &ino, fino);\n+\tfuse4fs_start(ff);\n+\tret = fuse4fs_statx(ff, ino, mask, &stx);\n+\tif (ret)\n+\t\tgoto out;\n+out:\n+\tfuse4fs_finish(ff, ret);\n+\tif (ret)\n+\t\tfuse_reply_err(req, -ret);\n+\telse\n+\t\tfuse_reply_statx(req, 0, &stx, FUSE4FS_ATTR_TIMEOUT);\n+}\n+#else\n+# define op_statx\t\tNULL\n+#endif\n+\n static void op_readlink(fuse_req_t req, fuse_ino_t fino)\n {\n \tstruct ext2_inode inode;\n@@ -7484,6 +7617,9 @@ static struct fuse_lowlevel_ops fs_ops = {\n #ifdef SUPPORT_FALLOCATE\n \t.fallocate = op_fallocate,\n #endif\n+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 18)\n+\t.statx = op_statx,\n+#endif\n #ifdef HAVE_FUSE_IOMAP\n \t.iomap_begin = op_iomap_begin,\n \t.iomap_end = op_iomap_end,\ndiff --git a/misc/fuse2fs.c b/misc/fuse2fs.c\nindex 138346fcc4517f..f9e8fca096ec2c 100644\n--- a/misc/fuse2fs.c\n+++ b/misc/fuse2fs.c\n@@ -23,6 +23,7 @@\n #include <sys/xattr.h>\n #endif\n #include <sys/ioctl.h>\n+#include <sys/sysmacros.h>\n #include <unistd.h>\n #include <ctype.h>\n #ifdef HAVE_FUSE_LOOPDEV\n@@ -2006,6 +2007,133 @@ static int op_getattr_iflags(const char *path, struct stat *statbuf,\n }\n #endif\n \n+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 18) && defined(STATX_BASIC_STATS)\n+static inline void fuse2fs_set_statx_attr(struct statx *stx,\n+\t\t\t\t\t uint64_t statx_flag, int set)\n+{\n+\tif (set)\n+\t\tstx->stx_attributes |= statx_flag;\n+\tstx->stx_attributes_mask |= statx_flag;\n+}\n+\n+static void fuse2fs_statx_directio(struct fuse2fs *ff, struct statx *stx)\n+{\n+\tstruct statx devx;\n+\terrcode_t err;\n+\tint fd;\n+\n+\terr = io_channel_get_fd(ff->fs->io, &fd);\n+\tif (err)\n+\t\treturn;\n+\n+\terr = statx(fd, \"\", AT_EMPTY_PATH, STATX_DIOALIGN, &devx);\n+\tif (err)\n+\t\treturn;\n+\tif (!(devx.stx_mask & STATX_DIOALIGN))\n+\t\treturn;\n+\n+\tstx->stx_mask |= STATX_DIOALIGN;\n+\tstx->stx_dio_mem_align = devx.stx_dio_mem_align;\n+\tstx->stx_dio_offset_align = devx.stx_dio_offset_align;\n+}\n+\n+static int fuse2fs_statx(struct fuse2fs *ff, ext2_ino_t ino, int statx_mask,\n+\t\t\t struct statx *stx)\n+{\n+\tstruct ext2_inode_large inode;\n+\text2_filsys fs = ff->fs;;\n+\tdev_t fakedev = 0;\n+\terrcode_t err;\n+\tstruct timespec tv;\n+\n+\terr = fuse2fs_read_inode(fs, ino, &inode);\n+\tif (err)\n+\t\treturn translate_error(fs, ino, err);\n+\n+\tmemcpy(&fakedev, fs->super->s_uuid, sizeof(fakedev));\n+\tstx->stx_mask = STATX_BASIC_STATS;\n+\tstx->stx_dev_major = major(fakedev);\n+\tstx->stx_dev_minor = minor(fakedev);\n+\tstx->stx_ino = ino;\n+\tstx->stx_mode = inode.i_mode;\n+\tstx->stx_nlink = inode.i_links_count;\n+\tstx->stx_uid = inode_uid(inode);\n+\tstx->stx_gid = inode_gid(inode);\n+\tstx->stx_size = EXT2_I_SIZE(&inode);\n+\tstx->stx_blksize = fs->blocksize;\n+\tstx->stx_blocks = ext2fs_get_stat_i_blocks(fs,\n+\t\t\t\t\t\tEXT2_INODE(&inode));\n+\tEXT4_INODE_GET_XTIME(i_atime, &tv, &inode);\n+\tstx->stx_atime.tv_sec = tv.tv_sec;\n+\tstx->stx_atime.tv_nsec = tv.tv_nsec;\n+\n+\tEXT4_INODE_GET_XTIME(i_mtime, &tv, &inode);\n+\tstx->stx_mtime.tv_sec = tv.tv_sec;\n+\tstx->stx_mtime.tv_nsec = tv.tv_nsec;\n+\n+\tEXT4_INODE_GET_XTIME(i_ctime, &tv, &inode);\n+\tstx->stx_ctime.tv_sec = tv.tv_sec;\n+\tstx->stx_ctime.tv_nsec = tv.tv_nsec;\n+\n+\tif (EXT4_FITS_IN_INODE(&inode, i_crtime)) {\n+\t\tstx->stx_mask |= STATX_BTIME;\n+\t\tEXT4_INODE_GET_XTIME(i_crtime, &tv, &inode);\n+\t\tstx->stx_btime.tv_sec = tv.tv_sec;\n+\t\tstx->stx_btime.tv_nsec = tv.tv_nsec;\n+\t}\n+\n+\tdbg_printf(ff, \"%s: ino=%d atime=%lld.%d mtime=%lld.%d ctime=%lld.%d btime=%lld.%d\\n\",\n+\t\t __func__, ino,\n+\t\t (long long int)stx->stx_atime.tv_sec, stx->stx_atime.tv_nsec,\n+\t\t (long long int)stx->stx_mtime.tv_sec, stx->stx_mtime.tv_nsec,\n+\t\t (long long int)stx->stx_ctime.tv_sec, stx->stx_ctime.tv_nsec,\n+\t\t (long long int)stx->stx_btime.tv_sec, stx->stx_btime.tv_nsec);\n+\n+\tif (LINUX_S_ISCHR(inode.i_mode) ||\n+\t LINUX_S_ISBLK(inode.i_mode)) {\n+\t\tif (inode.i_block[0]) {\n+\t\t\tstx->stx_rdev_major = major(inode.i_block[0]);\n+\t\t\tstx->stx_rdev_minor = minor(inode.i_block[0]);\n+\t\t} else {\n+\t\t\tstx->stx_rdev_major = major(inode.i_block[1]);\n+\t\t\tstx->stx_rdev_minor = minor(inode.i_block[1]);\n+\t\t}\n+\t}\n+\n+\tfuse2fs_set_statx_attr(stx, STATX_ATTR_COMPRESSED,\n+\t\t\t inode.i_flags & EXT2_COMPR_FL);\n+\tfuse2fs_set_statx_attr(stx, STATX_ATTR_IMMUTABLE,\n+\t\t\t inode.i_flags & EXT2_IMMUTABLE_FL);\n+\tfuse2fs_set_statx_attr(stx, STATX_ATTR_APPEND,\n+\t\t\t inode.i_flags & EXT2_APPEND_FL);\n+\tfuse2fs_set_statx_attr(stx, STATX_ATTR_NODUMP,\n+\t\t\t inode.i_flags & EXT2_NODUMP_FL);\n+\n+\tfuse2fs_statx_directio(ff, stx);\n+\n+\treturn 0;\n+}\n+\n+static int op_statx(const char *path, int statx_flags, int statx_mask,\n+\t\t struct statx *stx, struct fuse_file_info *fi)\n+{\n+\tstruct fuse2fs *ff = fuse2fs_get();\n+\text2_ino_t ino;\n+\tint ret = 0;\n+\n+\tFUSE2FS_CHECK_CONTEXT(ff);\n+\tfuse2fs_start(ff);\n+\tret = fuse2fs_file_ino(ff, path, fi, &ino);\n+\tif (ret)\n+\t\tgoto out;\n+\tret = fuse2fs_statx(ff, ino, statx_mask, stx);\n+out:\n+\tfuse2fs_finish(ff, ret);\n+\treturn ret;\n+}\n+#else\n+# define op_statx\t\tNULL\n+#endif\n \n static int op_readlink(const char *path, char *buf, size_t len)\n {\n@@ -6793,6 +6921,9 @@ static struct fuse_operations fs_ops = {\n #ifdef SUPPORT_FALLOCATE\n \t.fallocate = op_fallocate,\n #endif\n+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 18)\n+\t.statx = op_statx,\n+#endif\n #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 99)\n \t.getattr_iflags = op_getattr_iflags,\n #endif\n", "prefixes": [ "16/19" ] }