Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp826511rwb; Wed, 26 Jul 2023 03:37:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlHaaW5R2s+ByvMmwheeBPCv423YKxIr2e2fd7gU2vDXLT6mN7Yv4m5Mc8jdhPT+95Rbkg1x X-Received: by 2002:a17:906:9f25:b0:989:34a0:45b0 with SMTP id fy37-20020a1709069f2500b0098934a045b0mr1313367ejc.49.1690367869403; Wed, 26 Jul 2023 03:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690367869; cv=none; d=google.com; s=arc-20160816; b=oKaB6rS3gbvlsKioPbNPqV9PtTSqGzFaAJ1XR45jG1DCEHPXYjQ2g1nPbeN3BKjBOf YzXOnYTSMmKrVVno85QYVhM3fkP0ljJM2cL5zBsuJHY5MdoK5zX367lyRUJvOSPPaGK8 7DUqpWuH21+s9Y6YIVE1Bu0bC/zGKqDhhpDNKmMou+OSgNwDpOCvvMlb+elaJrZOTbOr /7S/JkHT+tCbjZZR/Wk8FEKPZYNQP3f7GN/3B01H29yK1cm+Zx5Oxh8JjBXJn+uDWxeK wLbB82F7bxRNW0DImiPVdp3WW+8H+nQNHRzZ0IS4Iw9C4J+h4Wn/Gca73bZjlqQthfTI e9mg== 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=t0lbx0okQPpnQcTB5T0YEuJud2LpJ8hVugIPpSWDV7w=; fh=s3EkFveja4PFWbIac+xkRWU8Dk/FoQIVbxjqrCu6kgU=; b=c40cOopOXjhukXqwpurpL/PpVujpqYAQzVTXwvDKtuDKopG9yxmrRIcLdcufOTTEiq kVnW1j7rY4Y1UNJZl7037WJplaMAr9KJygOTNqCm+Vk0AzlHIKjFCXoDCucBsIWFccnl TJPLt6Xxg8am0gc9a48XeIadK5/vL7gkAAe4Gu+4BGWafwTnWofutu9gSi4jcJYWTcFo gcjhsX4jVx3A2pcarQCd90Mvy5+S0ACWNOuWLxLYzZ7yj2aKwhaOoeVCk4pZ5LZMDk7b GNKXuT++dJe3bQX468hFW5c9vqJzO8gVtFqYeRmcGgzz52Ta1P5xQ2Jw0I5dViXi6hcQ QKkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OKa1Ghl3; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lf7-20020a170907174700b009938899a39bsi9832023ejc.861.2023.07.26.03.37.25; Wed, 26 Jul 2023 03:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OKa1Ghl3; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233860AbjGZKcT (ORCPT + 99 others); Wed, 26 Jul 2023 06:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233862AbjGZKcS (ORCPT ); Wed, 26 Jul 2023 06:32:18 -0400 Received: from out-13.mta1.migadu.com (out-13.mta1.migadu.com [95.215.58.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1502D2126 for ; Wed, 26 Jul 2023 03:32:17 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690367182; 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=t0lbx0okQPpnQcTB5T0YEuJud2LpJ8hVugIPpSWDV7w=; b=OKa1Ghl3A+ogwl4hhQ2WP9H85sDGeelCB9uN/0woiPW2QDvC0n/UU+xX3ZCc/i++HBvMFi bYy/udIPlmg0hmu2H0RZAT3RvuKNrOVZUqAT9aUbE3aC9BJnMhjgtF4Ezi1urVgNun+wGg h1ajFNXPk7IAGlZa+Fh+WOWOxn7qvzk= From: Hao Xu To: io-uring@vger.kernel.org, Jens Axboe Cc: Dominique Martinet , Pavel Begunkov , Christian Brauner , Alexander Viro , Stefan Roesch , Clay Harris , Dave Chinner , "Darrick J . Wong" , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, Wanpeng Li Subject: [PATCH 2/7] xfs: add nowait support for xfs_seek_iomap_begin() Date: Wed, 26 Jul 2023 18:25:58 +0800 Message-Id: <20230726102603.155522-3-hao.xu@linux.dev> In-Reply-To: <20230726102603.155522-1-hao.xu@linux.dev> References: <20230726102603.155522-1-hao.xu@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-ext4@vger.kernel.org From: Hao Xu To support nowait llseek(), IOMAP_NOWAIT semantics should be respected. In xfs, xfs_seek_iomap_begin() is the only place which may be blocked by ilock and extent loading. Let's turn it into trylock logic just like what we've done in xfs_readdir(). Signed-off-by: Hao Xu --- fs/xfs/xfs_iomap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 18c8f168b153..bbd7c6b27701 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -1294,7 +1294,9 @@ xfs_seek_iomap_begin( if (xfs_is_shutdown(mp)) return -EIO; - lockmode = xfs_ilock_data_map_shared(ip); + lockmode = xfs_ilock_data_map_shared_generic(ip, flags & IOMAP_NOWAIT); + if (!lockmode) + return -EAGAIN; error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK); if (error) goto out_unlock; -- 2.25.1