Skip to content

Commit a47a6b7

Browse files
committed
btrfs-progs: update kernel status of sha256 accelerated support
Kernels 6.16 and newer always select the accelerated implementation, don't print the warning if such kernel is running and update documentation. Issue: #1049 Signed-off-by: David Sterba <[email protected]>
1 parent 8dbc699 commit a47a6b7

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Documentation/ch-checksumming.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ BLAKE2b 14500 34 builtin, reference impl.
7575
======== ============ ======= ================================
7676

7777
Many kernels are configured with SHA256 as built-in and not as a module.
78-
The accelerated versions are however provided by the modules and must be loaded
78+
Up to kernel v6.15 the accelerated versions are however provided by the
79+
modules and must be loaded
7980
explicitly (:command:`modprobe sha256`) before mounting the filesystem to make use of
8081
them. You can check in :file:`/sys/fs/btrfs/FSID/checksum` which one is used. If you
8182
see *sha256-generic*, then you may want to unmount and mount the filesystem
8283
again. Changing that on a mounted filesystem is not possible.
84+
85+
Since kernel v6.16 the accelereated implementation is always used if available.
86+
8387
Check the file :file:`/proc/crypto`, when the implementation is built-in, you'd find:
8488

8589
.. code-block:: none

mkfs/main.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <pthread.h>
3030
#include <uuid/uuid.h>
3131
#include <blkid/blkid.h>
32+
#include <linux/version.h>
3233
#include "kernel-lib/list.h"
3334
#include "kernel-lib/list_sort.h"
3435
#include "kernel-lib/rbtree.h"
@@ -2410,10 +2411,14 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
24102411
list_all_devices(root, opt_zoned);
24112412

24122413
if (mkfs_cfg.csum_type == BTRFS_CSUM_TYPE_SHA256) {
2413-
printf(
2414-
"NOTE: you may need to manually load kernel module implementing accelerated SHA256 in case\n"
2414+
u32 kernel_version = get_running_kernel_version();
2415+
2416+
if (kernel_version < KERNEL_VERSION(6,16,0)) {
2417+
printf(
2418+
"NOTE: in kernels < v6.16 you may need to manually load kernel module implementing accelerated SHA256 in case\n"
24152419
" the generic implementation is built-in, before mount. Check lsmod or /proc/crypto\n\n"
2416-
);
2420+
);
2421+
}
24172422
}
24182423
}
24192424

0 commit comments

Comments
 (0)