summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/checksum.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-26 23:49:34 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:10:16 +0200
commit4637429e3946d083eedde1668c17a4fadaf3c0b1 (patch)
treee963537ab982b1a82fa0aa33afab53713ce33fa7 /fs/bcachefs/checksum.c
parentbcachefs: KEY_TYPE_error now counts towards i_sectors (diff)
downloadlinux-4637429e3946d083eedde1668c17a4fadaf3c0b1.tar.xz
linux-4637429e3946d083eedde1668c17a4fadaf3c0b1.zip
bcachefs: bch2_sb_field_get() refactoring
Instead of using token pasting to generate methods for each superblock section, just make the type a parameter to bch2_sb_field_get(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/checksum.c')
-rw-r--r--fs/bcachefs/checksum.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
index 839f00dce50f..3c761ad6b1c8 100644
--- a/fs/bcachefs/checksum.c
+++ b/fs/bcachefs/checksum.c
@@ -678,7 +678,7 @@ int bch2_disable_encryption(struct bch_fs *c)
mutex_lock(&c->sb_lock);
- crypt = bch2_sb_get_crypt(c->disk_sb.sb);
+ crypt = bch2_sb_field_get(c->disk_sb.sb, crypt);
if (!crypt)
goto out;
@@ -712,7 +712,7 @@ int bch2_enable_encryption(struct bch_fs *c, bool keyed)
mutex_lock(&c->sb_lock);
/* Do we already have an encryption key? */
- if (bch2_sb_get_crypt(c->disk_sb.sb))
+ if (bch2_sb_field_get(c->disk_sb.sb, crypt))
goto err;
ret = bch2_alloc_ciphers(c);
@@ -740,7 +740,8 @@ int bch2_enable_encryption(struct bch_fs *c, bool keyed)
if (ret)
goto err;
- crypt = bch2_sb_resize_crypt(&c->disk_sb, sizeof(*crypt) / sizeof(u64));
+ crypt = bch2_sb_field_resize(&c->disk_sb, crypt,
+ sizeof(*crypt) / sizeof(u64));
if (!crypt) {
ret = -BCH_ERR_ENOSPC_sb_crypt;
goto err;
@@ -781,7 +782,7 @@ int bch2_fs_encryption_init(struct bch_fs *c)
goto out;
}
- crypt = bch2_sb_get_crypt(c->disk_sb.sb);
+ crypt = bch2_sb_field_get(c->disk_sb.sb, crypt);
if (!crypt)
goto out;