From: Omar Sandoval <osandov@osandov.com>
To: Howard McLauchlan <linux@hmclauchlan.com>
Cc: linux-btrfs@vger.kernel.org, Chris Mason <clm@fb.com>,
Josef Bacik <jbacik@fb.com>, David Sterba <dsterba@suse.com>,
Filipe Manana <fdmanana@suse.com>,
Filipe David Borba Manana <fdmanana@gmail.com>,
Howard McLauchlan <hmclauchlan@fb.com>
Subject: Re: [RFC PATCH 5/6] btrfs: add send_stream_version attribute to sysfs
Date: Wed, 16 May 2018 12:04:24 -0700 [thread overview]
Message-ID: <20180516190424.GD29231@vader> (raw)
In-Reply-To: <20180509020651.7946-6-linux@hmclauchlan.com>
On Tue, May 08, 2018 at 10:06:50PM -0400, Howard McLauchlan wrote:
> From: Filipe David Borba Manana <fdmanana@gmail.com>
>
> So that applications can find out what's the highest send stream
> version supported/implemented by the running kernel:
>
> $ cat /sys/fs/btrfs/send/stream_version
> 2
>
> [Howard: rebased on 4.17-rc4]
> Signed-off-by: Howard McLauchlan <hmclauchlan@fb.com>
> Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
> Reviewed-by: David Sterba <dsterba@suse.cz>
> ---
> fs/btrfs/send.h | 1 +
> fs/btrfs/sysfs.c | 29 +++++++++++++++++++++++++++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/fs/btrfs/send.h b/fs/btrfs/send.h
> index a5830d216ac1..2f5e25e03def 100644
> --- a/fs/btrfs/send.h
> +++ b/fs/btrfs/send.h
> @@ -12,6 +12,7 @@
> #define BTRFS_SEND_STREAM_MAGIC "btrfs-stream"
> #define BTRFS_SEND_STREAM_VERSION_1 1
> #define BTRFS_SEND_STREAM_VERSION_2 2
> +#define BTRFS_SEND_STREAM_VERSION_LATEST BTRFS_SEND_STREAM_VERSION_2
>
> #define BTRFS_SEND_BUF_SIZE SZ_64K
> #define BTRFS_SEND_READ_SIZE (48 * SZ_1K)
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index 4848a4318fb5..3c82cba91ff6 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -18,6 +18,7 @@
> #include "transaction.h"
> #include "sysfs.h"
> #include "volumes.h"
> +#include "send.h"
>
> static inline struct btrfs_fs_info *to_fs_info(struct kobject *kobj);
> static inline struct btrfs_fs_devices *to_fs_devs(struct kobject *kobj);
> @@ -884,6 +885,28 @@ static int btrfs_init_debugfs(void)
> return 0;
> }
>
> +static ssize_t send_stream_version_show(struct kobject *kobj,
> + struct kobj_attribute *a,
> + char *buf)
> +{
> + return snprintf(buf, PAGE_SIZE, "%d\n",
> + BTRFS_SEND_STREAM_VERSION_LATEST);
> +}
> +
> +BTRFS_ATTR(, stream_version, send_stream_version_show);
> +
> +static struct attribute *btrfs_send_attrs[] = {
> + BTRFS_ATTR_PTR(, stream_version),
> + NULL
> +};
> +
> +static const struct attribute_group btrfs_send_attr_group = {
> + .name = "send",
> + .attrs = btrfs_send_attrs,
> +};
> +
> +
> +
I know this is Filipe's code, but there are two extra newlines there ;)
Otherwise, assuming you tested this and it works as advertised,
Reviewed-by: Omar Sandoval <osandov@fb.com>
> int __init btrfs_init_sysfs(void)
> {
> int ret;
> @@ -900,8 +923,13 @@ int __init btrfs_init_sysfs(void)
> ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_feature_attr_group);
> if (ret)
> goto out2;
> + ret = sysfs_create_group(&btrfs_kset->kobj, &btrfs_send_attr_group);
> + if (ret)
> + goto out3;
>
> return 0;
> +out3:
> + sysfs_remove_group(&btrfs_kset->kobj, &btrfs_feature_attr_group);
> out2:
> debugfs_remove_recursive(btrfs_debugfs_root_dentry);
> out1:
> @@ -913,6 +941,7 @@ int __init btrfs_init_sysfs(void)
> void __cold btrfs_exit_sysfs(void)
> {
> sysfs_remove_group(&btrfs_kset->kobj, &btrfs_feature_attr_group);
> + sysfs_remove_group(&btrfs_kset->kobj, &btrfs_send_attr_group);
> kset_unregister(btrfs_kset);
> debugfs_remove_recursive(btrfs_debugfs_root_dentry);
> }
> --
> 2.17.0
>
next prev parent reply other threads:[~2018-05-16 19:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-09 2:06 [RFC PATCH 0/6] btrfs send stream version 2 Howard McLauchlan
2018-05-09 2:06 ` [RFC PATCH 1/6] btrfs: send, bump stream version Howard McLauchlan
2018-05-16 18:25 ` Omar Sandoval
2018-05-09 2:06 ` [RFC PATCH 2/6] btrfs: send, implement total data size command to allow for progress estimation Howard McLauchlan
2018-05-09 2:06 ` [RFC PATCH 3/6] btrfs: send, use fallocate command to punch holes Howard McLauchlan
2018-05-09 2:06 ` [RFC PATCH 4/6] btrfs: send, use fallocate command to allocate extents Howard McLauchlan
2018-05-09 2:06 ` [RFC PATCH 5/6] btrfs: add send_stream_version attribute to sysfs Howard McLauchlan
2018-05-16 19:04 ` Omar Sandoval [this message]
2018-05-09 2:06 ` [RFC PATCH 6/6] btrfs: add chattr support for send/receive Howard McLauchlan
2018-05-16 18:59 ` Omar Sandoval
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=20180516190424.GD29231@vader \
--to=osandov@osandov.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=fdmanana@gmail.com \
--cc=fdmanana@suse.com \
--cc=hmclauchlan@fb.com \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux@hmclauchlan.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.