btrfs-progs: header cleanups
cover btrfs-progs: header cleanups
[REPO]
https://github.com/adam900710/btrfs-progs/tree/headers_cleanup
This series is focusing on cleanup the unused headers.
This is mostly done by clangd, although it has some false alerts related to macro usages of a header.
But still it's pretty awesome to cleanup a lot of unnecessary headers. Only one special touch on pretty_size() macro, to change it to a static inline function to workaround the clangd bug.
The first patch would do the main heavy lifting, meanwhile the second patch is doing the BTRFS_FLAT_INCLUDES related cleanups for library-test code.
Unfortunately I didn't touch anything inside crypto/*, the main reason is I'm not confident enough to verify all the optimization for different instructions.
(And even less motivation after the infamous recent XZ backdoor attempt,
by a possibly state-sponsored sleeping agent, ruining the trust among open source community.)
Qu Wenruo (2):
btrfs-progs: headers cleanup
btrfs-progs: library-test: header and BTRFS_FLAT_INCLUDES cleanups
btrfs-corrupt-block.c | 1 - btrfs-sb-mod.c | 2 -- btrfs.c | 1 - cmds/device.c | 1 - cmds/filesystem-du.c | 1 - cmds/filesystem-usage.c | 1 - cmds/inspect.c | 3 --- cmds/quota.c | 1 - cmds/receive-dump.c | 1 - cmds/receive.c | 1 - cmds/reflink.c | 2 -- cmds/restore.c | 1 - cmds/scrub.c | 3 --- common/device-scan.c | 1 - common/open-utils.c | 1 - common/path-utils.c | 1 - common/send-stream.c | 1 - common/send-utils.c | 1 - common/string-utils.c | 2 -- common/units.h | 7 ++++++- common/utils.c | 1 - convert/main.c | 1 - convert/source-ext2.c | 1 - kernel-lib/mktables.c | 5 +---- kernel-shared/dir-item.c | 1 - kernel-shared/extent-tree.c | 1 - kernel-shared/file-item.c | 1 - kernel-shared/file.c | 2 -- kernel-shared/inode-item.c | 2 -- kernel-shared/messages.c | 1 - kernel-shared/root-tree.c | 1 - kernel-shared/tree-checker.c | 1 - kernel-shared/uuid-tree.c | 3 --- kernel-shared/zoned.c | 1 - libbtrfs/crc32c.c | 5 ++--- mkfs/common.c | 1 - mkfs/rootdir.c | 1 - tests/fsstress.c | 25 ++++++++++++------------- tests/ioctl-test.c | 1 - tests/library-test.c | 22 +++------------------- 40 files changed, 24 insertions(+), 86 deletions(-)
--
2.44.0
PATCH 1/2 btrfs-progs: headers cleanup
There are quite some headers included but not utilized, clangd would report those headers for cleanup.
However clangd (17.0.6 at the time of writing) has a bug that, the file is only utilizing a C macro in the header, clangd would still report the header as unused.
This involves the following exceptions:
- pretty_size()
There is not much need to declare it as a macro.
Redefine it as a static inline function to workaround the clangd bug.
- kernel-lib/mktables.c
False alert on inittype.h, as some types are defined as macros.
- libbtrfs/send-utils.c
False alert on limits.h, as some types are defined as macros.
- tests/array-tests.c
- tests/string-table-test.c
False alert on common/utils.h for ARRAY_SIZE() macro.
Some parts are not touched yet:
- crypto/*
This involves quite some optimization code for different instructions, making it pretty hard to comprehensively tested.
- tests/library-tests
As I'll do a more comprehensive cleanup involving BTRFS_FLAT_INCLUDES.
--- btrfs-corrupt-block.c | 1 - btrfs-sb-mod.c | 2 -- btrfs.c | 1 - cmds/device.c | 1 - cmds/filesystem-du.c | 1 - cmds/filesystem-usage.c | 1 - cmds/inspect.c | 3 --- cmds/quota.c | 1 - cmds/receive-dump.c | 1 - cmds/receive.c | 1 - cmds/reflink.c | 2 -- cmds/restore.c | 1 - cmds/scrub.c | 3 --- common/device-scan.c | 1 - common/open-utils.c | 1 - common/path-utils.c | 1 - common/send-stream.c | 1 - common/send-utils.c | 1 - common/string-utils.c | 2 -- common/units.h | 7 ++++++- common/utils.c | 1 - convert/main.c | 1 - convert/source-ext2.c | 1 - kernel-lib/mktables.c | 5 +---- kernel-shared/dir-item.c | 1 - kernel-shared/extent-tree.c | 1 - kernel-shared/file-item.c | 1 - kernel-shared/file.c | 2 -- kernel-shared/inode-item.c | 2 -- kernel-shared/messages.c | 1 - kernel-shared/root-tree.c | 1 - kernel-shared/tree-checker.c | 1 - kernel-shared/uuid-tree.c | 3 --- kernel-shared/zoned.c | 1 - libbtrfs/crc32c.c | 5 ++--- mkfs/common.c | 1 - mkfs/rootdir.c | 1 - tests/fsstress.c | 25 ++++++++++++------------- tests/ioctl-test.c | 1 - 39 files changed, 21 insertions(+), 67 deletions(-)
btrfs-corrupt-block.c +0 -1
@@ -20,7 +20,6 @@#include <stdio.h> #include <stdlib.h> #include <getopt.h> -#include <limits.h> #include <errno.h> #include <string.h> #include <unistd.h>
btrfs-sb-mod.c +0 -2
@@ -20,11 +20,9 @@#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <inttypes.h> #include <string.h> #include <limits.h> #include <byteswap.h> -#include "crypto/crc32c.h" #include "kernel-shared/disk-io.h" #define BLOCKSIZE (4096)
btrfs.c +0 -1
@@ -28,7 +28,6 @@#include "common/utils.h" #include "common/string-utils.h" #include "common/help.h" -#include "common/box.h" #include "common/messages.h" #include "cmds/commands.h"
cmds/device.c +0 -1
@@ -26,7 +26,6 @@#include <dirent.h> #include <stdbool.h> #include "kernel-shared/zoned.h" -#include "kernel-shared/volumes.h" #include "common/string-table.h" #include "common/utils.h" #include "common/help.h"
cmds/filesystem-du.c +0 -1
@@ -27,7 +27,6 @@#include <fcntl.h> #include <dirent.h> #include <errno.h> -#include <limits.h> #include <stdbool.h> #include <unistd.h> #include "kernel-lib/rbtree.h"
cmds/filesystem-usage.c +0 -1
@@ -26,7 +26,6 @@#include <errno.h> #include <fcntl.h> #include <dirent.h> -#include <limits.h> #include <uuid/uuid.h> #include "kernel-lib/sizes.h" #include "kernel-shared/ctree.h"
cmds/inspect.c +0 -3
@@ -26,7 +26,6 @@#include <stdlib.h> #include <errno.h> #include <getopt.h> -#include <limits.h> #include <dirent.h> #include <string.h> #include <unistd.h>
@@ -45,8 +44,6 @@#include "common/open-utils.h" #include "common/units.h" #include "common/string-utils.h" -#include "common/string-table.h" -#include "common/sort-utils.h" #include "common/tree-search.h" #include "cmds/commands.h"
cmds/quota.c +0 -1
@@ -16,7 +16,6 @@* Boston, MA 021110-1307, USA. */ -#include "kerncompat.h" #include <sys/ioctl.h> #include <dirent.h> #include <errno.h>
cmds/receive-dump.c +0 -1
@@ -17,7 +17,6 @@*/ #include "kerncompat.h" -#include <limits.h> #include <time.h> #include <ctype.h> #include <errno.h>
cmds/receive.c +0 -1
@@ -28,7 +28,6 @@#include <stdint.h> #include <fcntl.h> #include <getopt.h> -#include <limits.h> #include <errno.h> #include <endian.h> #include <stdbool.h>
cmds/reflink.c +0 -2
@@ -23,8 +23,6 @@#include <unistd.h> #include "kernel-lib/list.h" #include "common/messages.h" -#include "common/open-utils.h" -#include "common/parse-utils.h" #include "common/string-utils.h" #include "common/help.h" #include "cmds/commands.h"
cmds/restore.c +0 -1
@@ -28,7 +28,6 @@#include <regex.h> #include <getopt.h> #include <errno.h> -#include <limits.h> #include <stddef.h> #include <string.h> #if COMPRESSION_LZO
cmds/scrub.c +0 -3
@@ -31,7 +31,6 @@#include <ctype.h> #include <signal.h> #include <stdarg.h> -#include <limits.h> #include <dirent.h> #include <getopt.h> #include <errno.h>
@@ -50,11 +49,9 @@#include "common/open-utils.h" #include "common/units.h" #include "common/device-utils.h" -#include "common/parse-utils.h" #include "common/sysfs-utils.h" #include "common/string-table.h" #include "common/string-utils.h" -#include "common/parse-utils.h" #include "common/help.h" #include "cmds/commands.h"
common/device-scan.c +0 -1
@@ -28,7 +28,6 @@#include <unistd.h> #include <errno.h> #include <dirent.h> -#include <limits.h> #include <stdbool.h> #include <blkid/blkid.h> #include <uuid/uuid.h>
common/open-utils.c +0 -1
@@ -22,7 +22,6 @@#include <fcntl.h> #include <mntent.h> #include <errno.h> -#include <limits.h> #include <stdio.h> #include <string.h> #include "kernel-lib/list.h"
common/path-utils.c +0 -1
@@ -29,7 +29,6 @@#include <errno.h> #include <ctype.h> #include <libgen.h> -#include <limits.h> #include "common/path-utils.h" /*
common/send-stream.c +0 -1
@@ -22,7 +22,6 @@#include <stdlib.h> #include <string.h> #include <time.h> -#include "kernel-shared/accessors.h" #include "kernel-shared/uapi/btrfs_tree.h" #include "kernel-shared/uapi/btrfs.h" #include "kernel-shared/send.h"
common/send-utils.c +0 -1
@@ -20,7 +20,6 @@#include <sys/ioctl.h> #include <unistd.h> #include <fcntl.h> -#include <limits.h> #include <errno.h> #include <stdio.h> #include <stdlib.h>
common/string-utils.c +0 -2
@@ -16,8 +16,6 @@#include "kerncompat.h" #include <stdlib.h> -#include <stdio.h> -#include <limits.h> #include "common/string-utils.h" #include "common/messages.h" #include "common/parse-utils.h"
common/units.h +6 -1
@@ -43,7 +43,12 @@const char *pretty_size_mode (u64 size,unsigned mode);int pretty_size_snprintf (u64 size,char *str,size_t str_size,unsigned unit_mode); -#define pretty_size (size) pretty_size_mode(size, UNITS_DEFAULT) + +static inline const char *pretty_size (u64 size) +{ +return pretty_size_mode (size,UNITS_DEFAULT ); +} +void units_set_mode (unsigned *units,unsigned mode);void units_set_base (unsigned *units,unsigned base);unsigned int get_unit_mode_from_arg (int *argc,char *argv[],int df_mode);
common/utils.c +0 -1
@@ -32,7 +32,6 @@#include <unistd.h> #include <mntent.h> #include <ctype.h> -#include <limits.h> #include <strings.h> #include "kernel-lib/list.h" #include "kernel-shared/accessors.h"
convert/main.c +0 -1
@@ -91,7 +91,6 @@#include <pthread.h> #include <stdbool.h> #include <errno.h> -#include <limits.h> #include <string.h> #include <uuid/uuid.h> #include "kernel-lib/sizes.h"
convert/source-ext2.c +0 -1
@@ -21,7 +21,6 @@#include <linux/limits.h> #include <errno.h> #include <pthread.h> -#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
kernel-lib/mktables.c +1 -4
@@ -17,15 +17,12 @@/* * Btrfs-progs port, with following minor fixes: -* 1) Use "kerncompat.h" +* 1) Use "kerncompat.h" header for generated tables.c * 2) Get rid of __KERNEL__ related macros */ #include <stdio.h> -#include <string.h> #include <inttypes.h> -#include <stdlib.h> -#include <time.h> static uint8_t gfmul (uint8_t a,uint8_t b) {
kernel-shared/dir-item.c +0 -1
@@ -21,7 +21,6 @@#include <stdio.h> #include <string.h> #include <errno.h> -#include "kernel-lib/bitops.h" #include "kernel-shared/ctree.h" #include "kernel-shared/disk-io.h" #include "kernel-shared/accessors.h"
kernel-shared/extent-tree.c +0 -1
@@ -22,7 +22,6 @@#include <stdbool.h> #include <errno.h> #include <string.h> -#include "kernel-lib/bitops.h" #include "kernel-lib/list.h" #include "kernel-lib/rbtree.h" #include "kernel-lib/rbtree_types.h"
kernel-shared/file-item.c +0 -1
@@ -24,7 +24,6 @@#include "kernel-shared/transaction.h" #include "kernel-shared/file-item.h" #include "kernel-shared/extent_io.h" -#include "kernel-shared/uapi/btrfs.h" #include "common/internal.h" #define MAX_CSUM_ITEMS (r, size) ((((BTRFS_LEAF_DATA_SIZE(r->fs_info) - \
kernel-shared/file.c +0 -2
@@ -19,10 +19,8 @@#include "kerncompat.h" #include <errno.h> #include <string.h> -#include "kernel-lib/bitops.h" #include "kernel-shared/accessors.h" #include "kernel-shared/extent_io.h" -#include "kernel-shared/uapi/btrfs.h" #include "kernel-shared/uapi/btrfs_tree.h" #include "kernel-shared/ctree.h" #include "kernel-shared/compression.h"
kernel-shared/inode-item.c +0 -2
@@ -19,10 +19,8 @@#include "kerncompat.h" #include <errno.h> #include <stddef.h> -#include "kernel-lib/bitops.h" #include "kernel-shared/accessors.h" #include "kernel-shared/extent_io.h" -#include "kernel-shared/uapi/btrfs.h" #include "kernel-shared/uapi/btrfs_tree.h" #include "kernel-shared/ctree.h" #include "kernel-shared/disk-io.h"
kernel-shared/messages.c +0 -1
@@ -3,7 +3,6 @@#include "kerncompat.h" #include <errno.h> #include <stdarg.h> -#include "kernel-lib/bitops.h" #include "kernel-shared/ctree.h" #include "kernel-shared/messages.h"
kernel-shared/root-tree.c +0 -1
@@ -19,7 +19,6 @@#include "kerncompat.h" #include <errno.h> #include <string.h> -#include "kernel-lib/bitops.h" #include "kernel-shared/accessors.h" #include "kernel-shared/messages.h" #include "kernel-shared/extent_io.h"
kernel-shared/tree-checker.c +0 -1
@@ -19,7 +19,6 @@#include <sys/stat.h> #include <linux/limits.h> #include <errno.h> -#include <limits.h> #include <stdarg.h> #include "kernel-lib/overflow.h" #include "kernel-lib/bitops.h"
kernel-shared/uuid-tree.c +0 -3
@@ -21,7 +21,6 @@#include <stdio.h> #include <errno.h> #include <string.h> -#include "kernel-lib/bitops.h" #include "kernel-shared/accessors.h" #include "kernel-shared/extent_io.h" #include "kernel-shared/uapi/btrfs.h"
@@ -29,8 +28,6 @@#include "kernel-shared/ctree.h" #include "kernel-shared/messages.h" #include "kernel-shared/transaction.h" -#include "common/messages.h" -#include "common/utils.h" void btrfs_uuid_to_key (const u8 *uuid,u8 type,struct btrfs_key *key) {
kernel-shared/zoned.c +0 -1
@@ -28,7 +28,6 @@#include "kernel-shared/accessors.h" #include "kernel-shared/ctree.h" #include "kernel-shared/extent_io.h" -#include "kernel-shared/uapi/btrfs.h" #include "kernel-shared/uapi/btrfs_tree.h" #include "common/utils.h" #include "common/device-utils.h"
libbtrfs/crc32c.c +2 -3
@@ -8,7 +8,6 @@* */ -#include <inttypes.h> #include "libbtrfs/crc32c.h" uint32_t __crc32c_le (uint32_t crc,unsigned char const *data,uint32_t length);
@@ -53,7 +52,7 @@ static uint32_t crc32c_intel_le_hw_byte(uint32_t crc, unsigned char const *data, }/* -* Steps through buffer one byte at at time, calculates reflected +* Steps through buffer one byte at at time, calculates reflected * crc using table. */ static uint32_t crc32c_intel (uint32_t crc,unsigned char const *data,uint32_t length)
@@ -198,7 +197,7 @@ static const uint32_t crc32c_table[256] = { };/* -* Steps through buffer one byte at at time, calculates reflected +* Steps through buffer one byte at at time, calculates reflected * crc using table. */
mkfs/common.c +0 -1
@@ -17,7 +17,6 @@#include <sys/stat.h> #include <unistd.h> #include <fcntl.h> -#include <limits.h> #include <errno.h> #include <stdio.h> #include <stdlib.h>
mkfs/rootdir.c +0 -1
@@ -24,7 +24,6 @@#include <fcntl.h> #include <ftw.h> #include <errno.h> -#include <limits.h> #include <stdlib.h> #include <string.h> #include "kernel-lib/sizes.h"
tests/fsstress.c +12 -13
@@ -32,7 +32,6 @@#include <fcntl.h> #include <assert.h> #include <getopt.h> -#include "common/internal.h" #define AIO #define URING
@@ -1434,7 +1433,7 @@ fent_to_name(pathname_t *name, fent_t *fep)if (pfep ==NULL ) {fprintf (stderr,"%d: fent-id = %d: can't find parent id: %d\n" , procid, fep->id, fep->parent); - } + }#endif if (pfep ==NULL )return 0 ;
@@ -1545,7 +1544,7 @@ int generate_xattr_name(int xattr_num, char *buffer, int buflen) }/* -* Get file +* Get file * Input: "which" to choose the file-types eg. non-directory * Input: "r" to choose which file * Output: file-list, file-entry, name for the chosen file.
@@ -1585,7 +1584,7 @@ get_fname(int which, long r, pathname_t *name, flist_t **flpp, fent_t **fepp,* Now we have possible matches between 0..totalsum-1. * And we use r to help us choose which one we want, * which when bounded by totalsum becomes x. -*/ +*/ x = (int )(r % totalsum);for (i =0 , flp = flist; i < FT_nft; i++, flp++) {if (which & (1U << i)) {
@@ -1600,7 +1599,7 @@ get_fname(int which, long r, pathname_t *name, flist_t **flpp, fent_t **fepp,#ifdef DEBUG if (!e) {fprintf (stderr,"%d: failed to get path for entry:" -" id=%d,parent=%d\n" , +" id=%d,parent=%d\n" , procid, fep->id, fep->parent); }#endif
@@ -2007,7 +2006,7 @@ show_ops(int flag, char *lead_str)if (flag<0 ) {/* print in list form */ int x =WIDTH ; - +for (p = ops; p < ops_end; p++) {if (lead_str !=NULL && x+strlen (p->name)>=WIDTH -5 ) x=printf ("%s%s" , (p==ops)?"" :"\n" , lead_str);
@@ -2069,7 +2068,7 @@ symlink_path(const char *name1, pathname_t *name)char buf[NAME_MAX +1 ];pathname_t newname;int rval; - +if (!strcmp (name1, name->path)) {printf ("yikes! %s %s\n" , name1, name->path);return 0 ;
@@ -2647,7 +2646,7 @@ bulkstat_f(opnum_t opno, long r) bsr.icount=nent; bsr.ubuffer=t; bsr.ocount=&count; - +while (xfsctl ("." , fd,XFS_IOC_FSBULKSTAT , &bsr) ==0 && count >0 ) total += count;free (t);
@@ -2680,8 +2679,8 @@ bulkstat1_f(opnum_t opno, long r)check_cwd ();free_pathname (&f); }else { -/* -* pick a random inode +/* +* pick a random inode * * note this can generate kernel warning messages * since bulkstat_one will read the disk block that
@@ -2698,7 +2697,7 @@ bulkstat1_f(opnum_t opno, long r) v = verbose; } fd =open ("." ,O_RDONLY ); - + bsr.lastip=&ino; bsr.icount=1 ; bsr.ubuffer=&t;
@@ -3797,7 +3796,7 @@ dread_f(opnum_t opno, long r) len -= (len % align);if (len <=0 ) len = align; -else if (len > diob.d_maxiosz) +else if (len > diob.d_maxiosz) len = diob.d_maxiosz; buf =memalign (diob.d_mem, len); e =read (fd, buf, len) <0 ? errno :0 ;
@@ -3874,7 +3873,7 @@ dwrite_f(opnum_t opno, long r) len -= (len % align);if (len <=0 ) len = align; -else if (len > diob.d_maxiosz) +else if (len > diob.d_maxiosz) len = diob.d_maxiosz; buf =memalign (diob.d_mem, len); off %= maxfsize;
tests/ioctl-test.c +0 -1
@@ -19,7 +19,6 @@#include <stdlib.h> #include "kernel-shared/uapi/btrfs.h" -#include "kernel-shared/ctree.h" #define LIST_32_COMPAT \ ONE(BTRFS_IOC_SET_RECEIVED_SUBVOL_32)
Signature · 1 line
2.44.0
PATCH 2/2 btrfs-progs: library-test: header and BTRFS_FLAT_INCLUDES cleanups
In reply to Qu WenruoMacro BTRFS_FLAT_INCLUDES is utilized to indicate if we should include files directly from the source code headers, or libbtrfsutil headers.
Normally it should only be utlized by libbtrfsutil headers, for programs they should either rely on the source code headers, or the libbtrfsutil headers, not both.
The only exception is tests/library-test.c, which during tests we would prepare a temporary directory and populate it with compiled libbtrfsutil library and its headers, and compile library-test program against the libbtrfsutil we built (not the system one).
So library-test is never utilizing any headers inside the source tree, thus BTRFS_FLAT_INCLUDES is never set for it.
This can be verified by Makefile:
library-test: tests/library-test.c libbtrfs.so @echo " [TEST PREP] $@"$(eval TMPD=$(shell mktemp -d)) $(Q)mkdir -p $(TMPD)/include/btrfs && \ cp $(libbtrfs_headers) $(TMPD)/include/btrfs && \ cp libbtrfs.so.0.1 $(TMPD) && \ cd $(TMPD) && $(CC) -I$(TMPD)/include -o $@ $(addprefix $(ABSTOPDIR)/,$^) -Wl,-rpath=$(ABSTOPDIR) @echo " [TEST RUN] $@" $(Q)cd $(TMPD) && LD_PRELOAD=libbtrfs.so.0.1 ./$@ @echo " [TEST CLEAN] $@" $(Q)$(RM) -rf -- $(TMPD)
Note that, -DBTRFS_FLAT_INCLUDES is only defined in $CFLAGS, and we do not pass $CFLAGS for the compiling of library-test at all.
So this patch would remove the BTRFS_FLAT_INCLUDES related checks, replace it with a comment, then cleanup the unused headers.
--- tests/library-test.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-)
tests/library-test.c +3 -19
@@ -16,31 +16,15 @@* Boston, MA 021110-1307, USA. */ -#if BTRFS_FLAT_INCLUDES -#include "libbtrfs/kerncompat.h" -#include "libbtrfs/version.h" -#include "libbtrfs/ioctl.h" -#include "kernel-lib/rbtree.h" -#include "kernel-lib/list.h" -#include "kernel-shared/ctree.h" -#include "kernel-shared/send.h" -#include "common/send-stream.h" -#include "common/send-utils.h" -#else /* -* This needs to include headers the same way as an external program but must -* not use the existing system headers, so we use "...". +* This program is only linked to libbtrfsutil library, and only include +* headers from libbtrfsutil, so we do not use the filepath inside btrfs-progs +* source code. */ #include "btrfs/kerncompat.h" #include "btrfs/version.h" -#include "btrfs/rbtree.h" -#include "btrfs/list.h" -#include "btrfs/ctree.h" -#include "btrfs/ioctl.h" -#include "btrfs/send.h" #include "btrfs/send-stream.h" #include "btrfs/send-utils.h" -#endif /* * Reduced code snippet from snapper.git/snapper/Btrfs.cc
Signature · 1 line
2.44.0
Please drop the series.
As David mentioned in the github pull request, the LSP server is pretty aggressive as it can fully understand the different configurations.
We need a more comprehensive tests on all possible configuration/build targets/linked library etc.
Thanks,
Qu
Quoted 74 lines · Qu Wenruo
[REPO]
https://github.com/adam900710/btrfs-progs/tree/headers_cleanupThis series is focusing on cleanup the unused headers.
This is mostly done by clangd, although it has some false alerts related to macro usages of a header.
But still it's pretty awesome to cleanup a lot of unnecessary headers. Only one special touch on
pretty_size()macro, to change it to a static inline function to workaround the clangd bug.The first patch would do the main heavy lifting, meanwhile the second patch is doing the
BTRFS_FLAT_INCLUDESrelated cleanups for library-test code.Unfortunately I didn't touch anything inside
crypto/*, the main reason is I'm not confident enough to verify all the optimization for different instructions.(And even less motivation after the infamous recent XZ backdoor attempt,
by a possibly state-sponsored sleeping agent, ruining the trust among open source community.)Qu Wenruo (2):
btrfs-progs: headers cleanup
btrfs-progs: library-test: header andBTRFS_FLAT_INCLUDEScleanupsbtrfs-corrupt-block.c | 1 - btrfs-sb-mod.c | 2 -- btrfs.c | 1 - cmds/device.c | 1 - cmds/filesystem-du.c | 1 - cmds/filesystem-usage.c | 1 - cmds/inspect.c | 3 --- cmds/quota.c | 1 - cmds/receive-dump.c | 1 - cmds/receive.c | 1 - cmds/reflink.c | 2 -- cmds/restore.c | 1 - cmds/scrub.c | 3 --- common/device-scan.c | 1 - common/open-utils.c | 1 - common/path-utils.c | 1 - common/send-stream.c | 1 - common/send-utils.c | 1 - common/string-utils.c | 2 -- common/units.h | 7 ++++++- common/utils.c | 1 - convert/main.c | 1 - convert/source-ext2.c | 1 - kernel-lib/mktables.c | 5 +---- kernel-shared/dir-item.c | 1 - kernel-shared/extent-tree.c | 1 - kernel-shared/file-item.c | 1 - kernel-shared/file.c | 2 -- kernel-shared/inode-item.c | 2 -- kernel-shared/messages.c | 1 - kernel-shared/root-tree.c | 1 - kernel-shared/tree-checker.c | 1 - kernel-shared/uuid-tree.c | 3 --- kernel-shared/zoned.c | 1 - libbtrfs/crc32c.c | 5 ++--- mkfs/common.c | 1 - mkfs/rootdir.c | 1 - tests/fsstress.c | 25 ++++++++++++------------- tests/ioctl-test.c | 1 - tests/library-test.c | 22 +++------------------- 40 files changed, 24 insertions(+), 86 deletions(-)--
2.44.0
Quoted 7 lines · Qu Wenruo
Please drop the series.
As David mentioned in the github pull request, the LSP server is pretty aggressive as it can fully understand the different configurations.
We need a more comprehensive tests on all possible configuration/build targets/linked library etc.
A bit more coverage done, the btrfs.box target is built by default everywhere and some CI image builds also configure with --experimental. The static has dependencies that may not exist everywhere but the coverage seems fine for now.