From: Johannes Thumshirn <jthumshirn@suse.de>
To: David Sterba <dsterba@suse.com>
Cc: Linux BTRFS Mailinglist <linux-btrfs@vger.kernel.org>,
Nikolay Borisov <nborisov@suse.com>,
Johannes Thumshirn <jthumshirn@suse.de>
Subject: [PATCH 4/4] btrfs: show used checksum driver per filesystem in sysfs
Date: Mon, 7 Oct 2019 11:11:04 +0200 [thread overview]
Message-ID: <20191007091104.18095-5-jthumshirn@suse.de> (raw)
In-Reply-To: <20191007091104.18095-1-jthumshirn@suse.de>
Show the used driver for the checksum algorithm for the filesystem in
sysfs.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
fs/btrfs/sysfs.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index aeebbdfe1a98..11a3cf7f563e 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -9,6 +9,7 @@
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/bug.h>
+#include <crypto/hash.h>
#include "ctree.h"
#include "disk-io.h"
@@ -637,6 +638,19 @@ static ssize_t btrfs_metadata_uuid_show(struct kobject *kobj,
BTRFS_ATTR(, metadata_uuid, btrfs_metadata_uuid_show);
+static ssize_t btrfs_checksum_show(struct kobject *kobj,
+ struct kobj_attribute *a, char *buf)
+{
+ struct btrfs_fs_info *fs_info = to_fs_info(kobj);
+ u16 csum_type = btrfs_super_csum_type(fs_info->super_copy);
+
+ return snprintf(buf, PAGE_SIZE, "%s (%s)\n",
+ btrfs_super_csum_name(csum_type),
+ crypto_shash_driver_name(fs_info->csum_shash));
+}
+
+BTRFS_ATTR(, checksum, btrfs_checksum_show);
+
static const struct attribute *btrfs_attrs[] = {
BTRFS_ATTR_PTR(, label),
BTRFS_ATTR_PTR(, nodesize),
@@ -644,6 +658,7 @@ static const struct attribute *btrfs_attrs[] = {
BTRFS_ATTR_PTR(, clone_alignment),
BTRFS_ATTR_PTR(, quota_override),
BTRFS_ATTR_PTR(, metadata_uuid),
+ BTRFS_ATTR_PTR(, checksum),
NULL,
};
--
2.16.4
next prev parent reply other threads:[~2019-10-07 9:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 9:11 [PATCH 0/4] Add xxhash64 and sha256 as possible new checksums Johannes Thumshirn
2019-10-07 9:11 ` [PATCH 1/4] btrfs: add xxhash64 to checksumming algorithms Johannes Thumshirn
2019-10-07 9:11 ` [PATCH 2/4] btrfs: add sha256 " Johannes Thumshirn
2019-10-07 9:11 ` [PATCH 3/4] btrfs: sysfs: export supported checksums Johannes Thumshirn
2019-10-07 15:36 ` Nikolay Borisov
2019-10-07 15:46 ` David Sterba
2019-10-08 6:47 ` Johannes Thumshirn
2019-10-08 11:40 ` David Sterba
2019-10-07 9:11 ` Johannes Thumshirn [this message]
2019-10-07 14:58 ` [PATCH 0/4] Add xxhash64 and sha256 as possible new checksums Nikolay Borisov
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=20191007091104.18095-5-jthumshirn@suse.de \
--to=jthumshirn@suse.de \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.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