Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5326590rdb; Wed, 13 Dec 2023 05:52:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHyWx3ywJoAY48nuwHOGaryUKKGjQbinqz0sfCL8kgm9y9dBV7Eor4l4c8xHhx6tWEr8x4S X-Received: by 2002:a05:6a00:1aca:b0:6ce:2731:47b6 with SMTP id f10-20020a056a001aca00b006ce273147b6mr9609031pfv.22.1702475534473; Wed, 13 Dec 2023 05:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702475534; cv=none; d=google.com; s=arc-20160816; b=FZkud+esgrlcdd4vTNVYXKNnQNNJZmylWA97n5w9n6QJ7IWx8wEGKKJuGFmeSKfF4m nfi2yeWSaBTngo8qqbIgliIDU++UMZf6aRWeSB7hJRbmPDlhDHhcZ7J/A8GKFQ2bsu2W XRXc0vPASyAPMBpuo8UwkZMyv8E2TXoqCtwB8+bVfHRNV9Qbg1iXkWHRQoLFoeQR0naj NFrSucFO6fqyE85QbFnARb7Z595YRPuTRWNf6eDjZUh4iVvYOJORTjhS02snxOdh85uI 3NT8KfWvvi6EO1yoWPN8aZAkyduLJMQfm5KNdwOQc3X7tgiWrH/ITaWnNN19rRMe7TFo bMRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=At55AdxI0EVqvLoVtG7qh0zVypL7yPQ0gJ4RwZozN0o=; fh=9hT4l0EMR1D2zdgUoRXiqFwsybSJyrmM/FC/blQlPsI=; b=0+zlJSOFQOS8/qvxYT4LjW4hRSA4gMiOsi7ftpqQpaUVBfX4MDqpCrM6FD0FliFzx3 wYrPszhrnLL3cja12GhAM5gWwfgcg7tjvfp6TuDvdbJDbqV+64eNs6p2A0WjWyxrN//U JrNbWk5HYhN57Q7/7jg+1EEu4lANERLDh8qzeGPgKhCK6MI4WwMmSKnvMqXNZ2RZ+XKO /sETBnsvHI7khMFVat8hiQmcwHU2g/fAQ/GaJX4NBLoEiQKJ/bI6gaN3wojvXQ57xM9P 2DecNggIdLbUv2N4ZYROezEfE9jlW0jL4LUSGPAJbuxEwzHOljPs9lsA4xl+VglVOGUk 5FaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NjAZXPDY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id s17-20020a632c11000000b005c212ebb55csi9614649pgs.691.2023.12.13.05.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:52:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NjAZXPDY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 86DA08038B68; Wed, 13 Dec 2023 05:52:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379357AbjLMNvL (ORCPT + 99 others); Wed, 13 Dec 2023 08:51:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379331AbjLMNum (ORCPT ); Wed, 13 Dec 2023 08:50:42 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B70F295 for ; Wed, 13 Dec 2023 05:50:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702475432; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=At55AdxI0EVqvLoVtG7qh0zVypL7yPQ0gJ4RwZozN0o=; b=NjAZXPDYIU5KkbzxAwQDnGdzjUKdte4XOKtteXXmXQ5+/04qe6IP7Z+LsdiRbQNVOwf8qU 7y0SW9/VY1oJ8+yPNh/wwwCEXk0dj0u2E2UVjZVh83/QWlRMkK3ZyqyRRBf7nzmDIUyjzW VN87BuoCZKKThJTE0YpeVFYq5vvws9A= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-iTfH0SaSNVqQa9XMdNQ_yg-1; Wed, 13 Dec 2023 08:50:27 -0500 X-MC-Unique: iTfH0SaSNVqQa9XMdNQ_yg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5862F3C2A1C3; Wed, 13 Dec 2023 13:50:27 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D38C1121306; Wed, 13 Dec 2023 13:50:26 +0000 (UTC) From: David Howells To: Marc Dionne Cc: David Howells , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 13/40] afs: Use op->nr_iterations=-1 to indicate to begin fileserver iteration Date: Wed, 13 Dec 2023 13:49:35 +0000 Message-ID: <20231213135003.367397-14-dhowells@redhat.com> In-Reply-To: <20231213135003.367397-1-dhowells@redhat.com> References: <20231213135003.367397-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:52:03 -0800 (PST) Set op->nr_iterations to -1 to indicate that we need to begin fileserver iteration rather than setting error to SHRT_MAX. This makes it easier to eliminate the address cursor. Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/fs_operation.c | 2 +- fs/afs/internal.h | 2 +- fs/afs/rotate.c | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/afs/fs_operation.c b/fs/afs/fs_operation.c index 7a3803ce3a22..3e31fae9a149 100644 --- a/fs/afs/fs_operation.c +++ b/fs/afs/fs_operation.c @@ -41,7 +41,7 @@ struct afs_operation *afs_alloc_operation(struct key *key, struct afs_volume *vo op->cb_v_break = volume->cb_v_break; op->debug_id = atomic_inc_return(&afs_operation_debug_counter); op->error = -EDESTADDRREQ; - op->ac.error = SHRT_MAX; + op->nr_iterations = -1; _leave(" = [op=%08x]", op->debug_id); return op; diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 95bb37253cad..e43aef74c241 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -859,7 +859,7 @@ struct afs_operation { struct afs_call *call; unsigned long untried; /* Bitmask of untried servers */ short index; /* Current server */ - unsigned short nr_iterations; /* Number of server iterations */ + short nr_iterations; /* Number of server iterations */ unsigned int flags; #define AFS_OPERATION_STOP 0x0001 /* Set to cease iteration */ diff --git a/fs/afs/rotate.c b/fs/afs/rotate.c index 0829933f4d9a..4d2317a66385 100644 --- a/fs/afs/rotate.c +++ b/fs/afs/rotate.c @@ -116,7 +116,10 @@ bool afs_select_fileserver(struct afs_operation *op) unsigned int rtt; int error = op->ac.error, i; - _enter("%lx[%d],%lx[%d],%d,%d", + op->nr_iterations++; + + _enter("OP=%x+%x,%llx,%lx[%d],%lx[%d],%d,%d", + op->debug_id, op->nr_iterations, op->volume->vid, op->untried, op->index, op->ac.tried, op->ac.index, error, op->ac.abort_code); @@ -126,13 +129,11 @@ bool afs_select_fileserver(struct afs_operation *op) return false; } - op->nr_iterations++; + if (op->nr_iterations == 0) + goto start; /* Evaluate the result of the previous operation, if there was one. */ switch (error) { - case SHRT_MAX: - goto start; - case 0: default: /* Success or local failure. Stop. */