Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2389368rwb; Thu, 27 Jul 2023 06:37:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlE0iKf7SnvZu1f4OU9jmaehuqIyNww5a85fyIFU83WcZw2J4G0RK9BcIVVJF3wfCOVgfbjd X-Received: by 2002:a05:6402:1212:b0:522:2ce0:d80a with SMTP id c18-20020a056402121200b005222ce0d80amr1896271edw.35.1690465026244; Thu, 27 Jul 2023 06:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690465026; cv=none; d=google.com; s=arc-20160816; b=KzUsi2zLfYZcKKTJrxBuy5DdXJlh2Cpp7PJZiF3C6iZEYwgR9E8+loK00A8jrJTu/J zh0nGveJ9nUEydrg5V9gWyJtMtf9ZJsPO4FQMNHRD9r0J60dtJVbDIJ+VaAkDSVaJk3p LYNArOsAAg3VT/BIh+cjUwRbwrEZt2Fo/o2VMU2VHxmPsbqhXgFDBPWuSbrunziZjd72 u+WKpl+A/15B8dlrr2RedXL51W3FdHViQZxPXL8S0ikYaaHFllKQsT2IxLK3T2+OS4fD cYLEWN6/7FTQpt5UNnvTc9fxQkAWMMish/X2KevZvaxFM7OpUYDufYn4OOICm7ayQOfV yHWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:mime-version:date :dkim-signature:message-id; bh=3PYsZ8fztDLb8zB2LbfphLlVJcGazDoAn1755qEELm0=; fh=s3EkFveja4PFWbIac+xkRWU8Dk/FoQIVbxjqrCu6kgU=; b=RFhnpeOFlOqw7mwwVTzxIZw1zY3m2/d7ibtsgD12lnfG4t51G/+ERdF0ynaiaNSEGN EM+ZzHM1QVvfYGy7i6YirVf5NQbhyXtpYmTNJn9L7K8XaoTsUbI0Ggablgf6IWgxU0lz 54S44XOgDG3RXe4Ah96fTzhXLmN+7P7VTKKnceB4/hp4CcMncWPSrP7cqoq0prZSxZMz 2XMkX6llo7BWbHHXWIBPVYZMUL22Zl8775lvi7nBBTOYMXbzM416LcRdJyg8VfFi716/ Fgj4lOpZgsUuNYONli84tG7TKQsh/QdRXG10fNF4uRxuZ3xL8oqEfDsgYoWTlJFtBHcJ TN2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=biv65rS1; 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 k22-20020aa7c396000000b0051e0eba60bdsi906814edq.456.2023.07.27.06.36.35; Thu, 27 Jul 2023 06:37:06 -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=biv65rS1; 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 S232656AbjG0Ma6 (ORCPT + 99 others); Thu, 27 Jul 2023 08:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233114AbjG0Map (ORCPT ); Thu, 27 Jul 2023 08:30:45 -0400 X-Greylist: delayed 1180 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 27 Jul 2023 05:30:36 PDT Received: from out-110.mta0.migadu.com (out-110.mta0.migadu.com [IPv6:2001:41d0:1004:224b::6e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69565196 for ; Thu, 27 Jul 2023 05:30:35 -0700 (PDT) Message-ID: <09d2ab2b-1269-21f5-7b7d-410c0f311887@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690461034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3PYsZ8fztDLb8zB2LbfphLlVJcGazDoAn1755qEELm0=; b=biv65rS16yG471XhUCuu9oete8E5kBm4b82GXvrRalQJTSD34AanuOZBGtnbSG3cskzWDQ uvVFdCshOGn8Hc97zP4Awlr6XLLp3a0/jLxnkv556gFWy3W0bVcqrj8O4ICuxTAGhKugT1 +XbDMDfxi+u7P+jzDfj2cwrmVZQ4Gkc= Date: Thu, 27 Jul 2023 20:30:27 +0800 MIME-Version: 1.0 Subject: Re: [RFC 0/7] io_uring lseek Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. 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 References: <20230726102603.155522-1-hao.xu@linux.dev> In-Reply-To: <20230726102603.155522-1-hao.xu@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 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 On 7/26/23 18:25, Hao Xu wrote: > From: Hao Xu > > This series adds lseek for io_uring, the motivation to import this > syscall is in previous io_uring getdents patchset, we lack a way to > rewind the file cursor when it goes to the end of file. Another reason > is lseek is a common syscall, it's good for coding consistency when > users use io_uring as their main loop. > > Patch 1 is code clean for iomap > Patch 2 adds IOMAP_NOWAIT logic for iomap lseek > Patch 3 adds a nowait parameter to for IOMAP_NOWAIT control > Patch 4 adds llseek_nowait() for file_operations so that specific > filesystem can implement it for nowait lseek > Patch 5 adds llseek_nowait() implementation for xfs > Patch 6 adds a new vfs wrapper for io_uring use > Patch 7 is the main io_uring lseek implementation > > Note, this series depends on the previous io_uring getdents series. > > This is marked RFC since there is (at least) an issue to be discussed: > The work in this series is mainly to reslove a problem that the current > llseek() in struct file_operations doesn't have a place to deliver > nowait info, and adding an argument to it results in update for llseek > implementation of all filesystems (35 functions), so here I introduce > a new llseek_nowait() as a workaround. > > For performance, it has about 20%~30% improvement on iops. > The test program is just like the one for io_uring getdents, here is the > link to it: https://github.com/HowHsu/liburing/blob/llseek/test/lseek.c > - Each test runs about 30000 async requests/sync syscalls > - Each test runs 100 times and get the average value. > - offset is randomly generated value > - the file is a 1M all zero file > > [howeyxu@~]$ python3 run_lseek.py > test args: seek mode:SEEK_SET, offset: 334772 > Average of sync : 0.012300650000000002 > Average of iouring : 0.008528009999999999 > 30.67% > > [howeyxu@~]$ python3 run_lseek.py > test args: seek mode:SEEK_CUR, offset: 389292 > Average of sync : 0.012736129999999995 > Average of iouring : 0.00928725 > 27.08% > > [howeyxu@~]$ python3 run_lseek.py > test args: seek mode:SEEK_END, offset: 281141 > Average of sync : 0.01221595 > Average of iouring : 0.008442890000000003 > 30.89% > > [howeyxu@~]$ python3 run_lseek.py > test args: seek mode:SEEK_DATA, offset: 931103 > Average of sync : 0.015496230000000005 > Average of iouring : 0.012341509999999998 > 20.36% > > [howeyxu@~]$ python3 run_lseek.py > test args: seek mode:SEEK_HOLE, offset: 430194 > Average of sync : 0.01555663000000001 > Average of iouring : 0.012064940000000003 > 22.45% > > > Hao Xu (7): > iomap: merge iomap_seek_hole() and iomap_seek_data() > xfs: add nowait support for xfs_seek_iomap_begin() > add nowait parameter for iomap_seek() > add llseek_nowait() for struct file_operations > add llseek_nowait support for xfs > add vfs_lseek_nowait() > add lseek for io_uring > > fs/ext4/file.c | 9 ++--- > fs/gfs2/inode.c | 4 +-- > fs/iomap/seek.c | 42 ++++++----------------- > fs/read_write.c | 18 ++++++++++ > fs/xfs/xfs_file.c | 34 ++++++++++++++++--- > fs/xfs/xfs_iomap.c | 4 ++- > include/linux/fs.h | 4 +++ > include/linux/iomap.h | 6 ++-- > include/uapi/linux/io_uring.h | 1 + > io_uring/fs.c | 63 +++++++++++++++++++++++++++++++++++ > io_uring/fs.h | 3 ++ > io_uring/opdef.c | 8 +++++ > 12 files changed, 145 insertions(+), 51 deletions(-) > > > base-commit: 4a4b046082eca8ae90b654d772fccc30e9f23f4d Hi folks, I'll leave this patchset here before the io_uring getdents is merged, then come back and update this one. Thanks, Hao