From: "Darrick J. Wong" <djwong@kernel.org>
To: Timur Tabi <ttabi@nvidia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
linux-fsdevel@vger.kernel.org,
Michael Ellerman <michael@ellerman.id.au>
Subject: Re: [PATCH] debufgs: debugfs_create_blob can set the file size
Date: Wed, 7 Feb 2024 14:07:28 -0800 [thread overview]
Message-ID: <20240207220728.GL6184@frogsfrogsfrogs> (raw)
In-Reply-To: <20240207200619.3354549-1-ttabi@nvidia.com>
On Wed, Feb 07, 2024 at 02:06:19PM -0600, Timur Tabi wrote:
> debugfs_create_blob() is given the size of the blob, so use it to
> also set the size of the dentry. For example, efi=debug previously
> showed
>
> -r-------- 1 root root 0 Feb 7 13:30 boot_services_code0
> -r-------- 1 root root 0 Feb 7 13:30 boot_services_code1
> -r-------- 1 root root 0 Feb 7 13:30 boot_services_data0
> -r-------- 1 root root 0 Feb 7 13:30 boot_services_data1
> -r-------- 1 root root 0 Feb 7 13:30 boot_services_data2
> -r-------- 1 root root 0 Feb 7 13:30 boot_services_data3
> -r-------- 1 root root 0 Feb 7 13:30 boot_services_data4
>
> but with this patch it shows
>
> -r-------- 1 root root 12783616 Feb 7 13:26 boot_services_code0
> -r-------- 1 root root 262144 Feb 7 13:26 boot_services_code1
> -r-------- 1 root root 41705472 Feb 7 13:26 boot_services_data0
> -r-------- 1 root root 23187456 Feb 7 13:26 boot_services_data1
> -r-------- 1 root root 110645248 Feb 7 13:26 boot_services_data2
> -r-------- 1 root root 1048576 Feb 7 13:26 boot_services_data3
> -r-------- 1 root root 4096 Feb 7 13:26 boot_services_data4
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
> ---
> fs/debugfs/file.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index c6f4a9a98b85..d97800603a8f 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -1152,7 +1152,14 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode,
> struct dentry *parent,
> struct debugfs_blob_wrapper *blob)
> {
> - return debugfs_create_file_unsafe(name, mode & 0644, parent, blob, &fops_blob);
> + struct dentry *dentry;
> +
> + dentry = debugfs_create_file_unsafe(name, mode & 0644, parent, blob, &fops_blob);
> + if (!IS_ERR(dentry))
> + d_inode(dentry)->i_size = blob->size;
Aren't you supposed to use i_size_write for this?
--D
> +
> + return dentry;
> +
> }
> EXPORT_SYMBOL_GPL(debugfs_create_blob);
>
> --
> 2.34.1
>
>
prev parent reply other threads:[~2024-02-07 22:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 20:06 [PATCH] debufgs: debugfs_create_blob can set the file size Timur Tabi
2024-02-07 21:40 ` Dave Chinner
2024-02-07 21:44 ` Timur Tabi
2024-02-07 22:06 ` Dave Chinner
2024-02-07 22:18 ` Timur Tabi
2024-02-07 22:47 ` Dave Chinner
2024-02-07 22:07 ` Darrick J. Wong [this message]
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=20240207220728.GL6184@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=michael@ellerman.id.au \
--cc=rafael@kernel.org \
--cc=ttabi@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox