Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2356999rwb; Thu, 27 Jul 2023 06:11:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlEvEkEXNP1qI4SFS4gZW07aSWiridnBDZUSivI1FcP3nwWomkrjZQTfTAEacsmGdY7hthN/ X-Received: by 2002:a05:6a00:21c3:b0:64c:c5f9:1533 with SMTP id t3-20020a056a0021c300b0064cc5f91533mr5682302pfj.33.1690463507138; Thu, 27 Jul 2023 06:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690463507; cv=none; d=google.com; s=arc-20160816; b=OpYBsSgeAFm1E0sV7lC/mbwc5NI+2OlU3zAhci4EaAROC1OOdJ7WE9/bPyGkyf0ucx 8tYj2MnmR5efx2IATFwAZ6vd+YpreyHFW/uIl7rEI0HoEAlUaLXZI1dtXiuf9lHtP3la ZxxYzZwypKCKqR+l3BYvfq0PinZ8X2ZJ95JzJwGNGtbCrAxJntr/ENv4ZfKjtOhVEJBO brnqaR64fuYfCPnan3P25Bzxm8V6LrMzIihymifGj6CWjxqwRf2OUSgPE4/VgIn9uNrh DkqPI+TTHRpZKavwkQ72udIVw41PhnqNiI/hiXXjaQKvLLR36lM775hGj1DIaPwY0BQl nnOg== 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:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=exoCYtqs4lKqJRylVtrIZXW7kCXNeNEVdEMQ+pCJcHg=; fh=eOJbknS184ueP0Z32O/k3SkCaNq1DsLcmTlCKkt6P/I=; b=Ir/3LZXxQDeU/94fErp/iJzD4A5MDufMprbXgPJd5NdtrgXjjpbx6WCXl1SL5sLrsL v9SQuLlzKq6awLzLjGD+K/LPetn5mdnvV8b9MrY0uHwga1BLLcSCozhne5rodpL7eduS i4GZ39wb9N9bLnW+N/sDD2d6f95vtRrnH4S8nhEAzWWk4ZOo9PkOnv8KLUGm+6Mhpq1k ZErKpNdM+Bcg/49Pz/1I1Kkehv4wBW+jHYJdrkQ/aGgvolChaWZt2UXMYXXxsKYEg4iC mUScEZ2aWH55ntkIs2aTZHotZLs4DoIsBBV+UwT5a17KAqj5UiKojQAshKLvEIuT2h1D 9TGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=BaqiPSAG; 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 s129-20020a632c87000000b00563dbace36asi1214775pgs.748.2023.07.27.06.11.21; Thu, 27 Jul 2023 06:11:47 -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=BaqiPSAG; 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 S231657AbjG0M20 (ORCPT + 99 others); Thu, 27 Jul 2023 08:28:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234138AbjG0M1v (ORCPT ); Thu, 27 Jul 2023 08:27:51 -0400 Received: from out-93.mta1.migadu.com (out-93.mta1.migadu.com [IPv6:2001:41d0:203:375::5d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B92123C3F for ; Thu, 27 Jul 2023 05:27:06 -0700 (PDT) Message-ID: <34f3b7ce-41f1-49c8-781d-a73b48481e0d@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690460815; 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=exoCYtqs4lKqJRylVtrIZXW7kCXNeNEVdEMQ+pCJcHg=; b=BaqiPSAGVUuwX0RzK5qjvyw4xGjFXILgA4tzmXVsCDqGuG2yDXTXng8OfXu70jiSpl2Mc1 l+UYs0hvUrCoAMLSZK0qtW1qy1hp+Y8fQwHrSCGAJ3Okgh3TApfTYgNiXHl959CtqR9FKw dBf3wUP4UuwUyt1jj8JZqQYVznhkBBc= Date: Thu, 27 Jul 2023 20:26:47 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 5/7] add llseek_nowait support for xfs Content-Language: en-US To: Dave Chinner Cc: io-uring@vger.kernel.org, Jens Axboe , Dominique Martinet , Pavel Begunkov , Christian Brauner , Alexander Viro , Stefan Roesch , Clay Harris , "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> <20230726102603.155522-6-hao.xu@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Hao Xu In-Reply-To: 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/27/23 06:14, Dave Chinner wrote: > On Wed, Jul 26, 2023 at 06:26:01PM +0800, Hao Xu wrote: >> From: Hao Xu >> >> Add llseek_nowait() operation for xfs, it acts just like llseek(). The >> thing different is it delivers nowait parameter to iomap layer. >> >> Signed-off-by: Hao Xu >> --- >> fs/xfs/xfs_file.c | 29 +++++++++++++++++++++++++++-- >> 1 file changed, 27 insertions(+), 2 deletions(-) >> >> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c >> index 73adc0aee2ff..cba82264221d 100644 >> --- a/fs/xfs/xfs_file.c >> +++ b/fs/xfs/xfs_file.c >> @@ -1257,10 +1257,11 @@ xfs_file_readdir( >> } >> >> STATIC loff_t >> -xfs_file_llseek( >> +__xfs_file_llseek( >> struct file *file, >> loff_t offset, >> - int whence) >> + int whence, >> + bool nowait) >> { >> struct inode *inode = file->f_mapping->host; >> >> @@ -1282,6 +1283,28 @@ xfs_file_llseek( >> return vfs_setpos(file, offset, inode->i_sb->s_maxbytes); >> } >> >> +STATIC loff_t >> +xfs_file_llseek( >> + struct file *file, >> + loff_t offset, >> + int whence) >> +{ >> + return __xfs_file_llseek(file, offset, whence, false); >> +} >> + >> +STATIC loff_t >> +xfs_file_llseek_nowait( >> + struct file *file, >> + loff_t offset, >> + int whence, >> + bool nowait) >> +{ >> + if (file->f_op == &xfs_file_operations) >> + return __xfs_file_llseek(file, offset, whence, nowait); >> + else >> + return generic_file_llseek(file, offset, whence); >> +} >> + >> #ifdef CONFIG_FS_DAX >> static inline vm_fault_t >> xfs_dax_fault( >> @@ -1442,6 +1465,7 @@ xfs_file_mmap( >> >> const struct file_operations xfs_file_operations = { >> .llseek = xfs_file_llseek, >> + .llseek_nowait = xfs_file_llseek_nowait, >> .read_iter = xfs_file_read_iter, >> .write_iter = xfs_file_write_iter, >> .splice_read = xfs_file_splice_read, >> @@ -1467,6 +1491,7 @@ const struct file_operations xfs_dir_file_operations = { >> .read = generic_read_dir, >> .iterate_shared = xfs_file_readdir, >> .llseek = generic_file_llseek, >> + .llseek_nowait = xfs_file_llseek_nowait, >> .unlocked_ioctl = xfs_file_ioctl, >> #ifdef CONFIG_COMPAT >> .compat_ioctl = xfs_file_compat_ioctl, > > This is pretty nasty. It would be far better just to change the > .llseek method than to inflict this on every filesystem for the > forseeable future. > > Not that I'm a fan of passing "nowait" booleans all through the file > operations methods - that way lies madness. We use a control > structure for the IO path operations (kiocb) to hold per-call > context information, perhaps we need something similar for these > other methods that people are wanting to hook up to io_uring (e.g. > readdir) so taht we don't have to play whack-a-mole with every new > io_uring method that people want and then end up with a different > nowait solution for every method. > > -Dave. whack-a-mole is exactly what I thought when I tried to find a place to hold that...I'll think about it in next version, a generic structure for io_uring is good I believe. I'll update this patchset after the getdents stuff are merged. Thanks, Hao