Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp703579pxm; Fri, 25 Feb 2022 17:45:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNsi4G7g6vh1N/Q4omd2hWGJ4F9chCtTh/KuS+Sdjz4PYTMGYoOtMYZ7m31+bfhNNgqpz7 X-Received: by 2002:a63:da06:0:b0:372:f5c5:8f92 with SMTP id c6-20020a63da06000000b00372f5c58f92mr8436390pgh.311.1645839929549; Fri, 25 Feb 2022 17:45:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645839929; cv=none; d=google.com; s=arc-20160816; b=cqZDP6uRnxUL3lXwvWN8BqP7x6OJtqiDIwz3PEMzfW3rtxXU8donvSW9YR/DNAhPml Qjes781XcBgAy/DUyoeSj0tPrd1gjTPr94xnsc53ld6eH6MyVqO9/CY7lXJBvlmzFIKF dPmsEoqDkSdniCVvCauJejB27i0pDs6yyifV9iro+tW2tFQshwB6jTH32Th1BdxOn3AW 6ONd2bFXyduwR0bINTuy5VYrOl0UN7dydRgb7T6Ct9vP+YwI/QypsuaeX9c8VpMIid4k kVbwWdiUErOIMoyT4iEHlVWtQViLt7xDMEcaaFd1HHRDxVnY2dXJ/McmEPp2fnSYe8Co gu3w== 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:to:from :dkim-signature; bh=8L7esi7byxp+v+enaKDS6DmM6AzLGcJ30ayxKevWm5E=; b=Z7zjlXc8RZqlunRu62pp7ZeD76vPhoYE0uQ+LI+MeEnP1o2TueuNux95GTu37UZ5hr 3/nRnCRYo7oDAye/ecv3JmnPo04zrWHiQtZTP7cD9jurvqJtzF96X4j0lOSncxtQeGml ZPKZQ556pj0PBnt5OI/q/VUoTGg7kYN9IaKXgSnE1oZ2ui2IHgI5oPlcxbjic0tak2vk VRPf4UNHxyh7sSSKTQhb8v498lwt9kk6NBiy34lNbxw63lev5BWxvzKaY3gWCvtz7u3u Qwsqb1VcB75g6TCHlrqjunwI+Yq2IiCQNc+ZgqQH6ZO6kjCBCO2rFurNDpC2hbszVbPC XTyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rbMUv23l; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d15-20020a656b8f000000b0037576c7484esi3506980pgw.387.2022.02.25.17.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 17:45:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rbMUv23l; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DA3DF24A82C; Fri, 25 Feb 2022 17:34:30 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233309AbiBYSfT (ORCPT + 99 others); Fri, 25 Feb 2022 13:35:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233371AbiBYSfQ (ORCPT ); Fri, 25 Feb 2022 13:35:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 133F51A94BE for ; Fri, 25 Feb 2022 10:34:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AED69B8330A for ; Fri, 25 Feb 2022 18:34:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30657C340F0 for ; Fri, 25 Feb 2022 18:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645814080; bh=pv10uEsrs9ZnKlQiBYTMYh9QSFk0gZyni6kyxxoc5wY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rbMUv23l/lIosRzAok8bgFLduEEqyEMNMxe07Pe+Do/o59oZ9flu/kHR2vf0QbcYS BM8aOLTMkCSmCMjHbH7rcRWcDen4Ka/rWe4sWM2TCon00tVMiKzLTxWpWmm/gQUd5s n+72+6vfKzYzcXR24SRjsO4tqs4XIemmvGp8A6puB4YxfakhtI84i9p+7PCDAICaUY uMtkZPVTdwCLbUTqKRMHf2ZL/EVSC3cylAYdQM/vL5TGrnoouqeCJWI52ZH2HyKNYy 7muAdg517K9/eg9Zb6E7v9U7/qdc+MjTLi1NHvyeD6a1Ahoz6IPEJBuR/LiEuL29Oa fSwaeK/1i3nBw== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v8 11/24] NFS: Simplify nfs_readdir_xdr_to_array() Date: Fri, 25 Feb 2022 13:28:16 -0500 Message-Id: <20220225182829.1236093-12-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220225182829.1236093-11-trondmy@kernel.org> References: <20220225182829.1236093-1-trondmy@kernel.org> <20220225182829.1236093-2-trondmy@kernel.org> <20220225182829.1236093-3-trondmy@kernel.org> <20220225182829.1236093-4-trondmy@kernel.org> <20220225182829.1236093-5-trondmy@kernel.org> <20220225182829.1236093-6-trondmy@kernel.org> <20220225182829.1236093-7-trondmy@kernel.org> <20220225182829.1236093-8-trondmy@kernel.org> <20220225182829.1236093-9-trondmy@kernel.org> <20220225182829.1236093-10-trondmy@kernel.org> <20220225182829.1236093-11-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Recent changes to readdir mean that we can cope with partially filled page cache entries, so we no longer need to rely on looping in nfs_readdir_xdr_to_array(). Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 2a0d119e3756..1c79244115f0 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -879,6 +879,7 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, size_t array_size; struct inode *inode = file_inode(desc->file); unsigned int dtsize = desc->dtsize; + unsigned int pglen; int status = -ENOMEM; entry = kzalloc(sizeof(*entry), GFP_KERNEL); @@ -896,28 +897,20 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, if (!pages) goto out; - do { - unsigned int pglen; - status = nfs_readdir_xdr_filler(desc, verf_arg, entry->cookie, - pages, dtsize, - verf_res); - if (status < 0) - break; - - pglen = status; - if (pglen == 0) { - nfs_readdir_page_set_eof(page); - break; - } - - verf_arg = verf_res; + status = nfs_readdir_xdr_filler(desc, verf_arg, entry->cookie, pages, + dtsize, verf_res); + if (status < 0) + goto free_pages; + pglen = status; + if (pglen != 0) status = nfs_readdir_page_filler(desc, entry, pages, pglen, arrays, narrays); - desc->buffer_fills++; - } while (!status && nfs_readdir_page_needs_filling(page) && - page_mapping(page)); + else + nfs_readdir_page_set_eof(page); + desc->buffer_fills++; +free_pages: nfs_readdir_free_pages(pages, array_size); out: nfs_free_fattr(entry->fattr); -- 2.35.1