From patchwork Wed May 3 06:03:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13229503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 196A3C7EE22 for ; Wed, 3 May 2023 06:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229505AbjECGEH (ORCPT ); Wed, 3 May 2023 02:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjECGEG (ORCPT ); Wed, 3 May 2023 02:04:06 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148FF30CB for ; Tue, 2 May 2023 23:04:04 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 707B81FFD3 for ; Wed, 3 May 2023 06:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683093843; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lz9jzlhBGS2UN45B0KbNx0Ewxf053x0ClejOm6V5uzs=; b=fy4L5KyYjWPGAL2c6r64e9RFrD0hiQem/M2EHz5EAf3vgHSGDMMPOf6q52fhtQhjyBZe8E rXuf5htBSOzepAmj7PmxCOcwLUlwvLFjREC0jwNBjujU9N2Tq3DFqcURqSgH6oAtDkZ6ep BHTYGqaBrJxJR3UaR8EawKjkKvLUd38= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B502B13584 for ; Wed, 3 May 2023 06:04:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UA55HlL5UWSTJAAAMHmgww (envelope-from ) for ; Wed, 03 May 2023 06:04:02 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 1/7] btrfs-progs: remove function btrfs_check_allocatable_zones() Date: Wed, 3 May 2023 14:03:37 +0800 Message-Id: <8358b7a43c479769bf32c1ccac24284442ceb567.1683093416.git.wqu@suse.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org This function is introduced by commit b031fe84fda8 ("btrfs-progs: zoned: implement zoned chunk allocator") but it never got called since then. Furthermore in the kernel zoned code, there is no such function from the very beginning, and everything is handled by btrfs_find_allocatable_zones(). Thus we can safely remove the function. Signed-off-by: Qu Wenruo Reviewed-by: Anand Jain --- kernel-shared/zoned.c | 58 ------------------------------------------- 1 file changed, 58 deletions(-) diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c index 7d2e68d08bcc..16abb042f5b0 100644 --- a/kernel-shared/zoned.c +++ b/kernel-shared/zoned.c @@ -596,64 +596,6 @@ size_t btrfs_sb_io(int fd, void *buf, off_t offset, int rw) return ret_sz; } -/* - * Check if spcecifeid region is suitable for allocation - * - * @device: the device to allocate a region - * @pos: the position of the region - * @num_bytes: the size of the region - * - * In non-ZONED device, anywhere is suitable for allocation. In ZONED - * device, check if: - * 1) the region is not on non-empty sequential zones, - * 2) all zones in the region have the same zone type, - * 3) it does not contain super block location - */ -bool btrfs_check_allocatable_zones(struct btrfs_device *device, u64 pos, - u64 num_bytes) -{ - struct btrfs_zoned_device_info *zinfo = device->zone_info; - u64 nzones, begin, end; - u64 sb_pos; - bool is_sequential; - int shift; - int i; - - if (!zinfo || zinfo->model == ZONED_NONE) - return true; - - nzones = num_bytes / zinfo->zone_size; - begin = pos / zinfo->zone_size; - end = begin + nzones; - - ASSERT(IS_ALIGNED(pos, zinfo->zone_size)); - ASSERT(IS_ALIGNED(num_bytes, zinfo->zone_size)); - - if (end > zinfo->nr_zones) - return false; - - shift = ilog2(zinfo->zone_size); - for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { - sb_pos = sb_zone_number(shift, i); - if (!(end < sb_pos || sb_pos + 1 < begin)) - return false; - } - - is_sequential = btrfs_dev_is_sequential(device, pos); - - while (num_bytes) { - if (is_sequential && !btrfs_dev_is_empty_zone(device, pos)) - return false; - if (is_sequential != btrfs_dev_is_sequential(device, pos)) - return false; - - pos += zinfo->zone_size; - num_bytes -= zinfo->zone_size; - } - - return true; -} - /** * btrfs_find_allocatable_zones - find allocatable zones within a given region * From patchwork Wed May 3 06:03:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13229507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13D44C77B78 for ; Wed, 3 May 2023 06:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229538AbjECGEL (ORCPT ); Wed, 3 May 2023 02:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbjECGEJ (ORCPT ); Wed, 3 May 2023 02:04:09 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76E612D69 for ; Tue, 2 May 2023 23:04:07 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 95F1B222BB for ; Wed, 3 May 2023 06:04:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683093844; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gc/DcSbgkZXnc9yM9UIWCvrDywEwKTPSSDEFALYanp4=; b=f3rdgFkb0tM7weLVKiNKIVDybw2YITyarTX836JK4lRhjgZYoLoicSl4bD+j3QL+sKk+Ta xrTs4NcccaOuQD6w3THsf4039+0r46RqRYs9zUFKKFTouVbPQ4MfMIVOHYJufCNXca5Deb R0rAGNGv94d1eWRYWPEkr+N22TXygcM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DA49C139F8 for ; Wed, 3 May 2023 06:04:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iCuJJ1P5UWSTJAAAMHmgww (envelope-from ) for ; Wed, 03 May 2023 06:04:03 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 2/7] btrfs-progs: libbtrfs: remove the support for fs without uuid tree Date: Wed, 3 May 2023 14:03:38 +0800 Message-Id: <6e07c5dd154bc70f9f0a1f9c31cede88dd564bb3.1683093416.git.wqu@suse.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Since kernel 3.12, any btrfs mounted by a kernel would have an UUID tree created, to record all the UUID of its subvolumes. Without UUID tree, libbtrfs send functionality has to go through all the subvolumes seen so far, and record those subvolumes' UUID internally so that libbtrfs send can locate a desired subvolume. Since commit 194b90aa2c5a ("btrfs-progs: libbtrfs: remove declarations without exports in send-utils") we're deprecating this old interface already, meaning deprecated users won't be able to build its own subvolume list already. And we received no error report on this so far. So let's finish the cleanup by removing the support for fs without an UUID tree. Signed-off-by: Qu Wenruo --- libbtrfs/send-utils.c | 396 ------------------------------------------ libbtrfs/send-utils.h | 20 --- 2 files changed, 416 deletions(-) diff --git a/libbtrfs/send-utils.c b/libbtrfs/send-utils.c index 831ec0dc1222..74bf86be7673 100644 --- a/libbtrfs/send-utils.c +++ b/libbtrfs/send-utils.c @@ -199,73 +199,6 @@ static int btrfs_read_root_item(int mnt_fd, u64 root_id, return 0; } -#ifdef BTRFS_COMPAT_SEND_NO_UUID_TREE -static struct rb_node *tree_insert(struct rb_root *root, - struct subvol_info *si, - enum subvol_search_type type) -{ - struct rb_node **p = &root->rb_node; - struct rb_node *parent = NULL; - struct subvol_info *entry; - __s64 comp; - - while (*p) { - parent = *p; - if (type == subvol_search_by_received_uuid) { - entry = rb_entry(parent, struct subvol_info, - rb_received_node); - - comp = memcmp(entry->received_uuid, si->received_uuid, - BTRFS_UUID_SIZE); - if (!comp) { - if (entry->stransid < si->stransid) - comp = -1; - else if (entry->stransid > si->stransid) - comp = 1; - else - comp = 0; - } - } else if (type == subvol_search_by_uuid) { - entry = rb_entry(parent, struct subvol_info, - rb_local_node); - comp = memcmp(entry->uuid, si->uuid, BTRFS_UUID_SIZE); - } else if (type == subvol_search_by_root_id) { - entry = rb_entry(parent, struct subvol_info, - rb_root_id_node); - comp = entry->root_id - si->root_id; - } else if (type == subvol_search_by_path) { - entry = rb_entry(parent, struct subvol_info, - rb_path_node); - comp = strcmp(entry->path, si->path); - } else { - BUG(); - } - - if (comp < 0) - p = &(*p)->rb_left; - else if (comp > 0) - p = &(*p)->rb_right; - else - return parent; - } - - if (type == subvol_search_by_received_uuid) { - rb_link_node(&si->rb_received_node, parent, p); - rb_insert_color(&si->rb_received_node, root); - } else if (type == subvol_search_by_uuid) { - rb_link_node(&si->rb_local_node, parent, p); - rb_insert_color(&si->rb_local_node, root); - } else if (type == subvol_search_by_root_id) { - rb_link_node(&si->rb_root_id_node, parent, p); - rb_insert_color(&si->rb_root_id_node, root); - } else if (type == subvol_search_by_path) { - rb_link_node(&si->rb_path_node, parent, p); - rb_insert_color(&si->rb_path_node, root); - } - return NULL; -} -#endif - int btrfs_subvolid_resolve(int fd, char *path, size_t path_len, u64 subvol_id) { if (path_len < 1) @@ -364,114 +297,6 @@ static int btrfs_subvolid_resolve_sub(int fd, char *path, size_t *path_len, return 0; } -#ifdef BTRFS_COMPAT_SEND_NO_UUID_TREE -static int count_bytes(void *buf, int len, char b) -{ - int cnt = 0; - int i; - - for (i = 0; i < len; i++) { - if (((char *)buf)[i] == b) - cnt++; - } - return cnt; -} - -void subvol_uuid_search_add(struct subvol_uuid_search *s, - struct subvol_info *si) -{ - int cnt; - - tree_insert(&s->root_id_subvols, si, subvol_search_by_root_id); - tree_insert(&s->path_subvols, si, subvol_search_by_path); - - cnt = count_bytes(si->uuid, BTRFS_UUID_SIZE, 0); - if (cnt != BTRFS_UUID_SIZE) - tree_insert(&s->local_subvols, si, subvol_search_by_uuid); - cnt = count_bytes(si->received_uuid, BTRFS_UUID_SIZE, 0); - if (cnt != BTRFS_UUID_SIZE) - tree_insert(&s->received_subvols, si, - subvol_search_by_received_uuid); -} - -static struct subvol_info *tree_search(struct rb_root *root, - u64 root_id, const u8 *uuid, - u64 stransid, const char *path, - enum subvol_search_type type) -{ - struct rb_node *n = root->rb_node; - struct subvol_info *entry; - __s64 comp; - - while (n) { - if (type == subvol_search_by_received_uuid) { - entry = rb_entry(n, struct subvol_info, - rb_received_node); - comp = memcmp(entry->received_uuid, uuid, - BTRFS_UUID_SIZE); - if (!comp) { - if (entry->stransid < stransid) - comp = -1; - else if (entry->stransid > stransid) - comp = 1; - else - comp = 0; - } - } else if (type == subvol_search_by_uuid) { - entry = rb_entry(n, struct subvol_info, rb_local_node); - comp = memcmp(entry->uuid, uuid, BTRFS_UUID_SIZE); - } else if (type == subvol_search_by_root_id) { - entry = rb_entry(n, struct subvol_info, - rb_root_id_node); - comp = entry->root_id - root_id; - } else if (type == subvol_search_by_path) { - entry = rb_entry(n, struct subvol_info, rb_path_node); - comp = strcmp(entry->path, path); - } else { - BUG(); - } - if (comp < 0) - n = n->rb_left; - else if (comp > 0) - n = n->rb_right; - else - return entry; - } - return NULL; -} - -/* - * this function will be only called if kernel doesn't support uuid tree. - */ -static struct subvol_info *subvol_uuid_search_old(struct subvol_uuid_search *s, - u64 root_id, const u8 *uuid, u64 transid, - const char *path, - enum subvol_search_type type) -{ - struct rb_root *root; - if (type == subvol_search_by_received_uuid) - root = &s->received_subvols; - else if (type == subvol_search_by_uuid) - root = &s->local_subvols; - else if (type == subvol_search_by_root_id) - root = &s->root_id_subvols; - else if (type == subvol_search_by_path) - root = &s->path_subvols; - else - return NULL; - return tree_search(root, root_id, uuid, transid, path, type); -} -#else -void subvol_uuid_search_add(struct subvol_uuid_search *s, - struct subvol_info *si) -{ - if (si) { - free(si->path); - free(si); - } -} -#endif - static struct subvol_info *subvol_uuid_search2(struct subvol_uuid_search *s, u64 root_id, const u8 *uuid, u64 transid, const char *path, @@ -569,11 +394,6 @@ static struct subvol_info *subvol_uuid_search2(struct subvol_uuid_search *s, struct btrfs_root_item root_item; struct subvol_info *info = NULL; -#ifdef BTRFS_COMPAT_SEND_NO_UUID_TREE - if (!s->uuid_tree_existed) - return subvol_uuid_search_old(s, root_id, uuid, transid, - path, type); -#endif switch (type) { case subvol_search_by_received_uuid: ret = btrfs_uuid_tree_lookup_any(s->mnt_fd, uuid, @@ -640,219 +460,3 @@ out: return info; } - -#ifdef BTRFS_COMPAT_SEND_NO_UUID_TREE -static int is_uuid_tree_supported(int fd) -{ - int ret; - struct btrfs_ioctl_search_args args; - struct btrfs_ioctl_search_key *sk = &args.key; - - memset(&args, 0, sizeof(args)); - - sk->tree_id = BTRFS_ROOT_TREE_OBJECTID; - - sk->min_objectid = BTRFS_UUID_TREE_OBJECTID; - sk->max_objectid = BTRFS_UUID_TREE_OBJECTID; - sk->max_type = BTRFS_ROOT_ITEM_KEY; - sk->min_type = BTRFS_ROOT_ITEM_KEY; - sk->max_offset = (u64)-1; - sk->max_transid = (u64)-1; - sk->nr_items = 1; - - ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args); - if (ret < 0) - return ret; - - /* the ioctl returns the number of item it found in nr_items */ - if (sk->nr_items == 0) - return 0; - - return 1; -} - -/* - * this function is mainly used to read all root items - * it will be only used when we use older kernel which uuid - * tree is not supported yet - */ -int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s) -{ - int ret; - struct btrfs_ioctl_search_args args; - struct btrfs_ioctl_search_key *sk = &args.key; - struct btrfs_ioctl_search_header *sh; - struct btrfs_root_item *root_item_ptr; - struct btrfs_root_item root_item = {}; - struct subvol_info *si = NULL; - int root_item_valid = 0; - unsigned long off = 0; - int i; - - s->mnt_fd = mnt_fd; - - s->root_id_subvols = RB_ROOT; - s->local_subvols = RB_ROOT; - s->received_subvols = RB_ROOT; - s->path_subvols = RB_ROOT; - - ret = is_uuid_tree_supported(mnt_fd); - if (ret < 0) { - fprintf(stderr, - "ERROR: check if we support uuid tree fails - %m\n"); - return ret; - } else if (ret) { - /* uuid tree is supported */ - s->uuid_tree_existed = 1; - return 0; - } - memset(&args, 0, sizeof(args)); - - sk->tree_id = BTRFS_ROOT_TREE_OBJECTID; - - sk->max_objectid = (u64)-1; - sk->max_offset = (u64)-1; - sk->max_transid = (u64)-1; - sk->min_type = BTRFS_ROOT_ITEM_KEY; - sk->max_type = BTRFS_ROOT_BACKREF_KEY; - sk->nr_items = 4096; - - while (1) { - ret = ioctl(mnt_fd, BTRFS_IOC_TREE_SEARCH, &args); - if (ret < 0) { - fprintf(stderr, "ERROR: can't perform the search - %m\n"); - return ret; - } - if (sk->nr_items == 0) - break; - - off = 0; - - for (i = 0; i < sk->nr_items; i++) { - sh = (struct btrfs_ioctl_search_header *)(args.buf + - off); - off += sizeof(*sh); - - if ((btrfs_search_header_objectid(sh) != 5 && - btrfs_search_header_objectid(sh) - < BTRFS_FIRST_FREE_OBJECTID) || - btrfs_search_header_objectid(sh) - > BTRFS_LAST_FREE_OBJECTID) { - goto skip; - } - - if (btrfs_search_header_type(sh) - == BTRFS_ROOT_ITEM_KEY) { - /* older kernels don't have uuids+times */ - if (btrfs_search_header_len(sh) - < sizeof(root_item)) { - root_item_valid = 0; - goto skip; - } - root_item_ptr = (struct btrfs_root_item *) - (args.buf + off); - memcpy(&root_item, root_item_ptr, - sizeof(root_item)); - root_item_valid = 1; - } else if (btrfs_search_header_type(sh) - == BTRFS_ROOT_BACKREF_KEY || - root_item_valid) { - char path_buf[PATH_MAX]; - char *path; - - if (!root_item_valid) - goto skip; - - ret = btrfs_subvolid_resolve(mnt_fd, path_buf, - sizeof(path_buf), - btrfs_search_header_objectid(sh)); - if (ret < 0) { - errno = -ret; - fprintf(stderr, "ERROR: unable to " - "resolve path " - "for root %llu: %m\n", - btrfs_search_header_objectid(sh)); - goto out; - } - path = strdup(path_buf); - - si = calloc(1, sizeof(*si)); - si->root_id = btrfs_search_header_objectid(sh); - memcpy(si->uuid, root_item.uuid, - BTRFS_UUID_SIZE); - memcpy(si->parent_uuid, root_item.parent_uuid, - BTRFS_UUID_SIZE); - memcpy(si->received_uuid, - root_item.received_uuid, - BTRFS_UUID_SIZE); - si->ctransid = btrfs_root_ctransid(&root_item); - si->otransid = btrfs_root_otransid(&root_item); - si->stransid = btrfs_root_stransid(&root_item); - si->rtransid = btrfs_root_rtransid(&root_item); - si->path = path; - subvol_uuid_search_add(s, si); - root_item_valid = 0; - } else { - goto skip; - } - -skip: - off += btrfs_search_header_len(sh); - - /* - * record the mins in sk so we can make sure the - * next search doesn't repeat this root - */ - sk->min_objectid = btrfs_search_header_objectid(sh); - sk->min_offset = btrfs_search_header_offset(sh); - sk->min_type = btrfs_search_header_type(sh); - } - sk->nr_items = 4096; - if (sk->min_offset < (u64)-1) - sk->min_offset++; - else if (sk->min_objectid < (u64)-1) { - sk->min_objectid++; - sk->min_offset = 0; - sk->min_type = 0; - } else - break; - } - -out: - return ret; -} - -void subvol_uuid_search_finit(struct subvol_uuid_search *s) -{ - struct rb_root *root = &s->root_id_subvols; - struct rb_node *node; - - if (!s->uuid_tree_existed) - return; - - while ((node = rb_first(root))) { - struct subvol_info *entry = - rb_entry(node, struct subvol_info, rb_root_id_node); - - free(entry->path); - rb_erase(node, root); - free(entry); - } - - s->root_id_subvols = RB_ROOT; - s->local_subvols = RB_ROOT; - s->received_subvols = RB_ROOT; - s->path_subvols = RB_ROOT; -} -#else -int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s) -{ - s->mnt_fd = mnt_fd; - - return 0; -} - -void subvol_uuid_search_finit(struct subvol_uuid_search *s) -{ -} -#endif diff --git a/libbtrfs/send-utils.h b/libbtrfs/send-utils.h index b39ee9255598..be6f91b1d7bb 100644 --- a/libbtrfs/send-utils.h +++ b/libbtrfs/send-utils.h @@ -35,12 +35,6 @@ extern "C" { #endif -/* - * Compatibility code for kernels < 3.12; the UUID tree is not available there - * and we have to do the slow search. This should be deprecated someday. - */ -#define BTRFS_COMPAT_SEND_NO_UUID_TREE 1 - enum subvol_search_type { subvol_search_by_root_id, subvol_search_by_uuid, @@ -49,12 +43,6 @@ enum subvol_search_type { }; struct subvol_info { -#ifdef BTRFS_COMPAT_SEND_NO_UUID_TREE - struct rb_node rb_root_id_node; - struct rb_node rb_local_node; - struct rb_node rb_received_node; - struct rb_node rb_path_node; -#endif u64 root_id; u8 uuid[BTRFS_UUID_SIZE]; @@ -70,14 +58,6 @@ struct subvol_info { struct subvol_uuid_search { int mnt_fd; -#ifdef BTRFS_COMPAT_SEND_NO_UUID_TREE - int uuid_tree_existed; - - struct rb_root root_id_subvols; - struct rb_root local_subvols; - struct rb_root received_subvols; - struct rb_root path_subvols; -#endif }; int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s); From patchwork Wed May 3 06:03:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13229504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F203DC77B78 for ; Wed, 3 May 2023 06:04:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbjECGEJ (ORCPT ); Wed, 3 May 2023 02:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjECGEI (ORCPT ); Wed, 3 May 2023 02:04:08 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107192D4E for ; Tue, 2 May 2023 23:04:07 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C5D101FFD7 for ; Wed, 3 May 2023 06:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683093845; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YBOc+tk7HjiHCHy00dY+beUHEk+PxbiCqyPMkqD0MpU=; b=VDkMgwtc9hihzhAss2PnB0UOxU/Kh8KKzBeocmljtPutx+6oZlg5doiK3+cPHxXd+Jw6/Z XmmGQ4ecchjcFdWc/X7RUPopD1ZMtEr5idaxE8u6hg3m99amX1jvIsCz6dHFDtop5Bw1GC D8CFsePVgdySyxKUfEwmtPQW0QSWruc= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0D30713584 for ; Wed, 3 May 2023 06:04:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kPwjMVT5UWSTJAAAMHmgww (envelope-from ) for ; Wed, 03 May 2023 06:04:04 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 3/7] btrfs-progs: crypto/blake2: remove blake2 simple API Date: Wed, 3 May 2023 14:03:39 +0800 Message-Id: <6f15cfedf228f6e8d855fcdcf125b678273534d6.1683093416.git.wqu@suse.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We never utilize such simple API, just remove it. Signed-off-by: Qu Wenruo --- crypto/blake2b-ref.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crypto/blake2b-ref.c b/crypto/blake2b-ref.c index eac4cf0c48da..f28dce3ae2a8 100644 --- a/crypto/blake2b-ref.c +++ b/crypto/blake2b-ref.c @@ -326,10 +326,6 @@ int blake2b( void *out, size_t outlen, const void *in, size_t inlen, const void return 0; } -int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen ) { - return blake2b(out, outlen, in, inlen, key, keylen); -} - #if defined(SUPERCOP) int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen ) { From patchwork Wed May 3 06:03:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13229505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CC52C77B75 for ; Wed, 3 May 2023 06:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229532AbjECGEK (ORCPT ); Wed, 3 May 2023 02:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjECGEJ (ORCPT ); Wed, 3 May 2023 02:04:09 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4046F3A95 for ; Tue, 2 May 2023 23:04:08 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EC3AE1FFD3 for ; Wed, 3 May 2023 06:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683093846; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9wPWNZyETvzqWmlGIwcWTxXcIRZfLAXReQIRyT1P1uY=; b=DE6UzjH01iLhz911QyG54LPdvx2cWE6b4pEdfbeojinsIYXAqBmEn8TWWGh4Vq+h9UGvnS NZm1GZ0HDfDrepMKfsCQ5fafr5PM35/EOq3sVj9krJcsS41wxfvEOPL2s8yrtF4A5EiCqU icrpBY2jBsp2uv9qqGLpaJfLTpydpS0= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3F40813584 for ; Wed, 3 May 2023 06:04:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oJW0AVb5UWSTJAAAMHmgww (envelope-from ) for ; Wed, 03 May 2023 06:04:06 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 4/7] btrfs-progs: crypto/blake2: move optimized declarations to blake2b.h Date: Wed, 3 May 2023 14:03:40 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org This is to avoid -Wmissing-prototypes warnings. Signed-off-by: Qu Wenruo --- crypto/blake2.h | 5 +++++ crypto/blake2b-ref.c | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/crypto/blake2.h b/crypto/blake2.h index cd89adb65a9b..052afe34a651 100644 --- a/crypto/blake2.h +++ b/crypto/blake2.h @@ -92,6 +92,11 @@ extern "C" { void blake2_init_accel(void); + /* Export optimized versions to silent -Wmissing-prototypes warnings. */ + void blake2b_compress_avx2( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] ); + void blake2b_compress_sse2( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] ); + void blake2b_compress_sse41( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] ); + #if defined(__cplusplus) } #endif diff --git a/crypto/blake2b-ref.c b/crypto/blake2b-ref.c index f28dce3ae2a8..489af399f945 100644 --- a/crypto/blake2b-ref.c +++ b/crypto/blake2b-ref.c @@ -220,10 +220,6 @@ static void blake2b_compress_ref( blake2b_state *S, const uint8_t block[BLAKE2B_ #undef G #undef ROUND -void blake2b_compress_sse2( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] ); -void blake2b_compress_sse41( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] ); -void blake2b_compress_avx2( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] ); - static void (*blake2b_compress)( blake2b_state *S, const uint8_t block[BLAKE2B_BLOCKBYTES] ) = blake2b_compress_ref; void blake2_init_accel(void) From patchwork Wed May 3 06:03:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13229506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29F33C7EE22 for ; Wed, 3 May 2023 06:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbjECGEN (ORCPT ); Wed, 3 May 2023 02:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjECGEK (ORCPT ); Wed, 3 May 2023 02:04:10 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662D13C3B for ; Tue, 2 May 2023 23:04:09 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2236F222BF for ; Wed, 3 May 2023 06:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683093848; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=njVf6CuNx/OcP3M1JFeRjib7Xyq98oey27rlZ5u/HoE=; b=mtbDvljWf873NO+Gud23b3kRsuqEwOrN6MZFVHp5Ip/dYMxwfzGzZQX/Ug0bDOJsiW6X5H M299hOiYVzhvVKJ+Dl+O01SBofyTf4JTDehYUlYMLVoPlzrNer4KmM9OnN0vKVCnnQgO7b HBAdxvc5xcC2D6zXPa0VikMcujyMWzk= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 67DC013584 for ; Wed, 3 May 2023 06:04:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8DtpC1f5UWSTJAAAMHmgww (envelope-from ) for ; Wed, 03 May 2023 06:04:07 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 5/7] btrfs-progs: crypto/sha: declare the x86 optimized implementation Date: Wed, 3 May 2023 14:03:41 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The optimized implementation sha256_process_x86() is not declared anywhere, this can be caught by -Wmissing-prototypes option. Just declare it properly in sha.h. Signed-off-by: Qu Wenruo --- crypto/sha.h | 3 +++ crypto/sha256-x86.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/crypto/sha.h b/crypto/sha.h index e65418ccd0d3..ea387c212dc6 100644 --- a/crypto/sha.h +++ b/crypto/sha.h @@ -211,4 +211,7 @@ extern int hmacResult(HMACContext *context, void sha256_init_accel(void); +/* Export for optimized version to silent -Wmissing-prototypes. */ +void sha256_process_x86(uint32_t state[8], const uint8_t data[], uint32_t length); + #endif /* _SHA_H_ */ diff --git a/crypto/sha256-x86.c b/crypto/sha256-x86.c index 602c53cf4f60..57be3f0db38f 100644 --- a/crypto/sha256-x86.c +++ b/crypto/sha256-x86.c @@ -13,6 +13,8 @@ # include #endif +#include "sha.h" + /* Process multiple blocks. The caller is responsible for setting the initial */ /* state, and the caller is responsible for padding the final block. */ void sha256_process_x86(uint32_t state[8], const uint8_t data[], uint32_t length) From patchwork Wed May 3 06:03:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13229509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52EA1C7EE25 for ; Wed, 3 May 2023 06:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbjECGEO (ORCPT ); Wed, 3 May 2023 02:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbjECGEN (ORCPT ); Wed, 3 May 2023 02:04:13 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A115E3A84 for ; Tue, 2 May 2023 23:04:11 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 482231FFD5 for ; Wed, 3 May 2023 06:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683093849; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H0RbmoQh3Q2naP6gkgtB1Qm8qhoe+Akt1dkMUtChVXc=; b=d1qDEhD7m+WiHP/6ewFTQ/PjOlfKf2YYibNLz8GUb/qCV5EW7E0VhY4B0TnGYKMw0prL2D 2qOldoDDACI8L9Ok4bUqKDMCtmARpdyjr3Pf3rzhE3KWbvwMgWKdaFkg0WHCYEvKsWfK32 6kaF0V9EB7BjuS0wE2zTfdlckuduovA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8E5B513584 for ; Wed, 3 May 2023 06:04:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sFMPFVj5UWSTJAAAMHmgww (envelope-from ) for ; Wed, 03 May 2023 06:04:08 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 6/7] btrfs-progs: fix -Wmissing-prototypes warnings Date: Wed, 3 May 2023 14:03:42 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The fixes involve the following changes: - Unexport functions which are not utilized out of the file * print_path_column() * parse_reflink_range() * btrfs_list_setup_print_column() * device_get_partition_size_sysfs() * max_zone_append_size() - Include related headers before implementing the function * change-uuid.c * convert-bgt.c * seed.h - Add missing headers caused by the above header changes * include for tune/tune.h. Signed-off-by: Qu Wenruo --- cmds/qgroup.c | 2 +- cmds/reflink.c | 2 +- cmds/subvolume-list.c | 2 +- common/device-utils.c | 2 +- common/utils.c | 2 +- kernel-shared/ulist.c | 2 +- kernel-shared/zoned.c | 2 +- tune/change-csum.c | 1 + tune/change-uuid.c | 1 + tune/convert-bgt.c | 1 + tune/seeding.c | 1 + tune/tune.h | 2 ++ 12 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmds/qgroup.c b/cmds/qgroup.c index 49014d5702ec..70a749aa4062 100644 --- a/cmds/qgroup.c +++ b/cmds/qgroup.c @@ -289,7 +289,7 @@ static void print_qgroup_column_add_blank(enum btrfs_qgroup_column_enum column, printf(" "); } -void print_path_column(struct btrfs_qgroup *qgroup) +static void print_path_column(struct btrfs_qgroup *qgroup) { struct btrfs_qgroup_list *list = NULL; diff --git a/cmds/reflink.c b/cmds/reflink.c index 24e562a744ff..14201349fc9f 100644 --- a/cmds/reflink.c +++ b/cmds/reflink.c @@ -58,7 +58,7 @@ struct reflink_range { bool same_file; }; -void parse_reflink_range(const char *str, u64 *from, u64 *length, u64 *to) +static void parse_reflink_range(const char *str, u64 *from, u64 *length, u64 *to) { char tmp[512]; int i; diff --git a/cmds/subvolume-list.c b/cmds/subvolume-list.c index 750fc4e6354d..a667290c1585 100644 --- a/cmds/subvolume-list.c +++ b/cmds/subvolume-list.c @@ -280,7 +280,7 @@ static struct { static btrfs_list_filter_func all_filter_funcs[]; static btrfs_list_comp_func all_comp_funcs[]; -void btrfs_list_setup_print_column(enum btrfs_list_column_enum column) +static void btrfs_list_setup_print_column(enum btrfs_list_column_enum column) { int i; diff --git a/common/device-utils.c b/common/device-utils.c index cb1a7a9d328a..70fbee49df1a 100644 --- a/common/device-utils.c +++ b/common/device-utils.c @@ -332,7 +332,7 @@ u64 device_get_partition_size_fd(int fd) return result; } -u64 device_get_partition_size_sysfs(const char *dev) +static u64 device_get_partition_size_sysfs(const char *dev) { int ret; char path[PATH_MAX] = {}; diff --git a/common/utils.c b/common/utils.c index 2c359dcf220f..3c67e1eb453c 100644 --- a/common/utils.c +++ b/common/utils.c @@ -498,7 +498,7 @@ static bool valid_escape(const char *str) * - line is advanced to the final separator or nul character * - returned path is a valid string terminated by zero or whitespace separator */ -char *read_path(char **line) +static char *read_path(char **line) { char *ret = *line; char *out = *line; diff --git a/kernel-shared/ulist.c b/kernel-shared/ulist.c index e193b02d5f33..6f231a3d9eab 100644 --- a/kernel-shared/ulist.c +++ b/kernel-shared/ulist.c @@ -72,7 +72,7 @@ void ulist_init(struct ulist *ulist) * This is useful in cases where the base 'struct ulist' has been statically * allocated. */ -void ulist_release(struct ulist *ulist) +static void ulist_release(struct ulist *ulist) { struct ulist_node *node; struct ulist_node *next; diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c index 16abb042f5b0..d187c5763406 100644 --- a/kernel-shared/zoned.c +++ b/kernel-shared/zoned.c @@ -92,7 +92,7 @@ u64 zone_size(const char *file) return strtoull((const char *)chunk, NULL, 10) << SECTOR_SHIFT; } -u64 max_zone_append_size(const char *file) +static u64 max_zone_append_size(const char *file) { char chunk[32]; int ret; diff --git a/tune/change-csum.c b/tune/change-csum.c index a11316860e3c..4531f2190f06 100644 --- a/tune/change-csum.c +++ b/tune/change-csum.c @@ -24,6 +24,7 @@ #include "kernel-shared/transaction.h" #include "common/messages.h" #include "common/internal.h" +#include "tune/tune.h" static int change_tree_csum(struct btrfs_trans_handle *trans, struct btrfs_root *root, int csum_type) diff --git a/tune/change-uuid.c b/tune/change-uuid.c index f148b9e54915..99ce0b15b2b9 100644 --- a/tune/change-uuid.c +++ b/tune/change-uuid.c @@ -25,6 +25,7 @@ #include "kernel-shared/volumes.h" #include "common/defs.h" #include "common/messages.h" +#include "tune/tune.h" #include "ioctl.h" static int change_fsid_prepare(struct btrfs_fs_info *fs_info, uuid_t new_fsid) diff --git a/tune/convert-bgt.c b/tune/convert-bgt.c index 27953cb26ada..c6bd4361f8ac 100644 --- a/tune/convert-bgt.c +++ b/tune/convert-bgt.c @@ -22,6 +22,7 @@ #include "kernel-shared/transaction.h" #include "common/messages.h" #include "common/extent-cache.h" +#include "tune/tune.h" /* After this many block groups we need to commit transaction. */ #define BLOCK_GROUP_BATCH 64 diff --git a/tune/seeding.c b/tune/seeding.c index 80b075e53baa..99ad455e9468 100644 --- a/tune/seeding.c +++ b/tune/seeding.c @@ -18,6 +18,7 @@ #include "kernel-shared/ctree.h" #include "kernel-shared/transaction.h" #include "common/messages.h" +#include "tune/tune.h" int update_seeding_flag(struct btrfs_root *root, const char *device, int set_flag, int force) { diff --git a/tune/tune.h b/tune/tune.h index 6beae9fc9ef7..753dc95eb138 100644 --- a/tune/tune.h +++ b/tune/tune.h @@ -17,6 +17,8 @@ #ifndef __BTRFS_TUNE_H__ #define __BTRFS_TUNE_H__ +#include + struct btrfs_root; struct btrfs_fs_info; From patchwork Wed May 3 06:03:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13229508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77032C77B75 for ; Wed, 3 May 2023 06:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229553AbjECGEQ (ORCPT ); Wed, 3 May 2023 02:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbjECGEN (ORCPT ); Wed, 3 May 2023 02:04:13 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8212D4E for ; Tue, 2 May 2023 23:04:11 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 791BF222BB for ; Wed, 3 May 2023 06:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683093850; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nFISrbfTjVQiVDrCtOqme+gK2OVOvPaZacqcePCW+pM=; b=T0TqqPCj88MKQH7NPB/Yu5fJFIs5JNYXmSZqE6Q21BunszXQg9r/Z62qfINEe+zJ2Eox7J yxZxj4fm6PlA6vCR1k4uD/kKonjfRBeFnFpgZjBeE6rscKONEY+wVU74Dk6uA1WeQl3UJU VQi8Qd9vztAEZxPCiKk3hjLoRqT50+I= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B538F13584 for ; Wed, 3 May 2023 06:04:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cPNLHln5UWSTJAAAMHmgww (envelope-from ) for ; Wed, 03 May 2023 06:04:09 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 7/7] btrfs-progs: Makefile: enable -Wmissing-prototypes Date: Wed, 3 May 2023 14:03:43 +0800 Message-Id: <3e2a5b954e10c9357573e9949def3a2a6f9944d2.1683093416.git.wqu@suse.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org With all the known warnings fixes, we can enable -Wmissing-prototypes and prevent such warnings from happening. Signed-off-by: Qu Wenruo --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b03367f26158..cdb3dee3ca4a 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,8 @@ DISABLE_WARNING_FLAGS := $(call cc-disable-warning, format-truncation) \ $(call cc-disable-warning, address-of-packed-member) # Warnings that we want by default -ENABLE_WARNING_FLAGS := $(call cc-option, -Wimplicit-fallthrough) +ENABLE_WARNING_FLAGS := $(call cc-option, -Wimplicit-fallthrough) \ + $(call cc-option, -Wmissing-prototypes) # Common build flags CFLAGS = $(SUBST_CFLAGS) \