From patchwork Thu Nov 9 15:39:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 163428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp521648vqs; Thu, 9 Nov 2023 07:43:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaej1JV+Dh4vBNju0+IdUt7Yi55cbtbon9/gIdgp6f0/u1X4/E/1QIYBdfQp5GH5MyM9SA X-Received: by 2002:a17:903:234e:b0:1cc:50f6:7fcc with SMTP id c14-20020a170903234e00b001cc50f67fccmr6313889plh.55.1699544593958; Thu, 09 Nov 2023 07:43:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699544593; cv=none; d=google.com; s=arc-20160816; b=tEeODk3NKQ1+YIYWrwg5W3B5ugFrkmnDfRPSNNG6wlf91m8aOOf3Seu3dPTs5knhbZ p3Hkb0DTkOlXuIDYQ/jUQ51K1QiklDPLdNM8DRx+nvfTF0sATHfVGFCA1OjqQEY6ijPS WtudUY/uuFVq4lUa5PIEh6GCYOXzf3vU6uAdV6nF+ZJC7cMCkoDHiVclCiAFG+VC7Pf9 coD1otxYg7/eyM2HblhAc+ywOeBw2RWX5cMTqboaCLAUPygfoqdMepKJH/YCRwlKi2wu qp58Ar8EuIufIs5Ym9k/u4/Sg685znMzd8afSaOLtiQRehhPth3m6DyTL4x1UrsbTyOY Sxfg== 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=Pt0bsPvfi9FBCVF7W8V+gVx20AkrHVXBl3QRM0ev98I=; fh=9hT4l0EMR1D2zdgUoRXiqFwsybSJyrmM/FC/blQlPsI=; b=hdgPzrOY3OAlaQbyyJ4XXmOeWNqskbNB+iT+pJIsIFbKgmK9MJRjHXX7BC8putJSrQ MB+oaUoODrrHOQPfTs+zBY4icqlg3uWYyANTPKImNpHcKe2Uu+vvLhPesuGCimne7Dl6 rlh2CCmdFWKnHYuDYDbgDhOikLNRDaEStxzUYNsWoeG/bRe9hUSOIEYTEBWjPZgaHttT 8gnGevEmFgpncZ4+g0BekTIPx+CAw+ExCIlqyJGG8vfn1TRLoqJwYDzUzD1chnklC9h3 wdpC0yd9TZITkVom8n++y4gRp7GjPKJVBBATWBV2CbDM0h5prjmnQa3rm/50NWM+mh9Z Po3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="BW/8YgKt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t18-20020a1709028c9200b001cc18133022si4787164plo.285.2023.11.09.07.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 07:43:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="BW/8YgKt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 4934B8374333; Thu, 9 Nov 2023 07:42:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344137AbjKIPmT (ORCPT + 31 others); Thu, 9 Nov 2023 10:42:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343850AbjKIPmD (ORCPT ); Thu, 9 Nov 2023 10:42:03 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 723BF358C for ; Thu, 9 Nov 2023 07:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699544439; 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=Pt0bsPvfi9FBCVF7W8V+gVx20AkrHVXBl3QRM0ev98I=; b=BW/8YgKtVOWPLe4RH2tVHTIUau7FqAgj3is1cTi5FFxYWKw3XFTuFZDQBTEd0mXrEgHrtq LN+oiwoB8vnLxi5GvOFaAOqtb1E0foxuDAJSwguRVCwixwzdwLvYDb3wlUPfQbj3Mfh8Nj O0Gc2NUWXzhMWEFQooCvLYm1krseaA4= 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-387-N4yfMwCOO0C0V_3rtPV5sA-1; Thu, 09 Nov 2023 10:40:38 -0500 X-MC-Unique: N4yfMwCOO0C0V_3rtPV5sA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 DFC6C38143D0; Thu, 9 Nov 2023 15:40:36 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DB4A492BFA; Thu, 9 Nov 2023 15:40:36 +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 14/41] afs: Use op->nr_iterations=-1 to indicate to begin fileserver iteration Date: Thu, 9 Nov 2023 15:39:37 +0000 Message-ID: <20231109154004.3317227-15-dhowells@redhat.com> In-Reply-To: <20231109154004.3317227-1-dhowells@redhat.com> References: <20231109154004.3317227-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 07:42:24 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782101672598817336 X-GMAIL-MSGID: 1782101672598817336 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 9182bd410bbd..3739110fc0b5 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -858,7 +858,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 342afc951fe4..beb9fd4e8f44 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. */