From patchwork Mon Mar 13 20:32:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ednadolski@gmail.com X-Patchwork-Id: 9622063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C02AB60492 for ; Mon, 13 Mar 2017 20:31:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0EEA28426 for ; Mon, 13 Mar 2017 20:31:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5FB5284CE; Mon, 13 Mar 2017 20:31:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4492728426 for ; Mon, 13 Mar 2017 20:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752673AbdCMUbd (ORCPT ); Mon, 13 Mar 2017 16:31:33 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33815 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbdCMUba (ORCPT ); Mon, 13 Mar 2017 16:31:30 -0400 Received: by mail-wm0-f65.google.com with SMTP id u132so11768463wmg.1 for ; Mon, 13 Mar 2017 13:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bI3UTRTSI77WhuMopuAxkDZWjao1zmspPNWBEB/lE5c=; b=FQV0OuUow/Om8FVt+a7AtIllNNox+52knatO6B5bwH1sVuXrHuS6PxigizdiOPWrPl 44FJ63Bjgs7qgM4W3SYZ+TQenWebIut72RLjE8sVfrGsvKWtkl/1htvFlf6oKbWxCyI6 0UhLoPVgBABBc9upZrStpKEd6EOm1pNd/Gg2XgymxaZHXUOJYPTYr0IvN4LzXAxbZ3x7 KG+RXCmGXWmyhjM7jTpH7q7c6PVvGS5EHgrDqiLvXN9VV/95n/AxY6/zNXRbQFdFV+kH yV6668Oy0Fu9Go6yplBb8ZTwowaf9ADG+3lIz5Z0Rd7nNAA+ludzrmyztowke8XfgK+N 4xPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bI3UTRTSI77WhuMopuAxkDZWjao1zmspPNWBEB/lE5c=; b=Wv9GnWQjqNzJtrmADioXu1r8YENXVC8a470h7lkmnHWPM48E0zMs0ImrQKF894hka+ D/xlICMynoMM2uKQEnpINZLUNXYhk0h6gRrsACgSHd40O/pGxn8U4pIJHXAbj/gq801t 7h2qnbPqgecyF6H8n5wg8QgE2heGn+7P0p6y+jSmRYKf3h7lj00QDEwtuoSn/DvgIfLE a0ZGTZiwCDV3w3FOciJJGy3KULUszkCpTQj8/9eEHmzU6ew1VNwJCLMua2N+2NKq4Z0p /Jt8WUHwLdU9Q38jhnRSjaLQaVLeDsIRajcZEpLhprWsb3IYl0N0vc/Hs4FDDrBbofuo 93Eg== X-Gm-Message-State: AFeK/H2UqTsPvZtVIgAmWCqqJ4q4b9sFBUJ/fgIrMqmrLMUh8WMPpCtXdE0kiRuonx57jg== X-Received: by 10.28.6.203 with SMTP id 194mr12525494wmg.125.1489437087666; Mon, 13 Mar 2017 13:31:27 -0700 (PDT) Received: from linux-mf65.suse.de (97-124-166-208.hlrn.qwest.net. [97.124.166.208]) by smtp.gmail.com with ESMTPSA id m201sm12678088wmd.19.2017.03.13.13.31.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Mar 2017 13:31:27 -0700 (PDT) From: ednadolski@gmail.com X-Google-Original-From: enadolski@suse.com To: linux-btrfs@vger.kernel.org Cc: Edmund Nadolski Subject: [PATCH 2/2] btrfs: replace hardcoded value with SEQ_NONE macro Date: Mon, 13 Mar 2017 14:32:04 -0600 Message-Id: <20170313203204.11857-3-enadolski@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170313203204.11857-1-enadolski@suse.com> References: <20170313203204.11857-1-enadolski@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Edmund Nadolski Define the SEQ_NONE macro to replace (u64)-1 in places where said value triggers a special-case ref search behavior. Signed-off-by: Edmund Nadolski Reviewed-by: Jeff Mahoney --- fs/btrfs/backref.c | 16 ++++++++-------- fs/btrfs/backref.h | 2 ++ fs/btrfs/qgroup.c | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index e794b6e..297de5b 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -538,7 +538,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, * slot==nritems. In that case, go to the next leaf before we continue. */ if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { - if (time_seq == (u64)-1) + if (time_seq == SEQ_NONE) ret = btrfs_next_leaf(root, path); else ret = btrfs_next_old_leaf(root, path, time_seq); @@ -582,7 +582,7 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path, eie = NULL; } next: - if (time_seq == (u64)-1) + if (time_seq == SEQ_NONE) ret = btrfs_next_item(root, path); else ret = btrfs_next_old_item(root, path, time_seq); @@ -634,7 +634,7 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info, if (path->search_commit_root) root_level = btrfs_header_level(root->commit_root); - else if (time_seq == (u64)-1) + else if (time_seq == SEQ_NONE) root_level = btrfs_header_level(root->node); else root_level = btrfs_old_root_level(root, time_seq); @@ -645,7 +645,7 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info, } path->lowest_level = level; - if (time_seq == (u64)-1) + if (time_seq == SEQ_NONE) ret = btrfs_search_slot(NULL, root, &ref->key_for_search, path, 0, 0); else @@ -1199,7 +1199,7 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info, * * NOTE: This can return values > 0 * - * If time_seq is set to (u64)-1, it will not search delayed_refs, and behave + * If time_seq is set to SEQ_NONE, it will not search delayed_refs, and behave * much like trans == NULL case, the difference only lies in it will not * commit root. * The special case is for qgroup to search roots in commit_transaction(). @@ -1246,7 +1246,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, path->skip_locking = 1; } - if (time_seq == (u64)-1) + if (time_seq == SEQ_NONE) path->skip_locking = 1; /* @@ -1276,9 +1276,9 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS if (trans && likely(trans->type != __TRANS_DUMMY) && - time_seq != (u64)-1) { + time_seq != SEQ_NONE) { #else - if (trans && time_seq != (u64)-1) { + if (trans && time_seq != SEQ_NONE) { #endif /* * look if there are updates for this ref queued and lock the diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h index 9c41fba..20915a6 100644 --- a/fs/btrfs/backref.h +++ b/fs/btrfs/backref.h @@ -23,6 +23,8 @@ #include "ulist.h" #include "extent_io.h" +#define SEQ_NONE ((u64)-1) + struct inode_fs_paths { struct btrfs_path *btrfs_path; struct btrfs_root *fs_root; diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index bb7e42f..76d84af 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -2077,12 +2077,12 @@ int btrfs_qgroup_account_extents(struct btrfs_trans_handle *trans, goto cleanup; } /* - * Use (u64)-1 as time_seq to do special search, which + * Use SEQ_NONE as time_seq to do special search, which * doesn't lock tree or delayed_refs and search current * root. It's safe inside commit_transaction(). */ ret = btrfs_find_all_roots(trans, fs_info, - record->bytenr, (u64)-1, &new_roots); + record->bytenr, SEQ_NONE, &new_roots); if (ret < 0) goto cleanup; if (qgroup_to_skip) {