Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4509517pxb; Mon, 21 Feb 2022 23:42:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDqLFM1Km0entXLQmlrcnofOUj5HVfAsbf28HD/BAfLSuI6YFMdKyKlao+a/lWXKYLYWs+ X-Received: by 2002:a17:902:7c01:b0:14a:c6d3:d9cb with SMTP id x1-20020a1709027c0100b0014ac6d3d9cbmr21869672pll.34.1645515731123; Mon, 21 Feb 2022 23:42:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645515731; cv=none; d=google.com; s=arc-20160816; b=n2c7hoZ7MdejtVcVAI+7gHXYgLRq3i/WrNfoJ6ll+FQe3B920a+WPXtKk+ube658jh OrT+z1ck5X9pTD65tngnQO+uSIHm5DtcnI1Vo/TysNcao6rOAd9PvrrV0jWS3B2KGyha oDI0APHAs1GSDIT+guW5L5cHW3m20lW8ezHWZyuXLKecw3OD8brd2e5/O93PErHMnKtt N3JT/A75ce1VLuN/Kt0QXLN7P4PDzNijWkOcz0CBwcN/BINUMHpGas2MR5Ur3TpUxN/c yWh2a7JHN9xvpJHMn0p+YkKWnh0zjdCXelYQ0Tunvb+jXylYlDK4kIwqTAFPx+/xYhro F2ow== 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:user-agent:mime-version :date:message-id; bh=cktcIq4dOprAPlBNJkHThB1dzeHhf1C8GTK16PXU6BM=; b=YK1W9Eo/cPZqVrje7XMgC/5F89IE9izvw+U62EWRnlVtnuh7Rxm7SaofMp9UZnLrHz TgLcA0Lx87MSKdynqSlIyafXlE9qIDIa9w3VIa1fjy6/NtHSJrAsHPuyhvcffMucChce 216zpp0BhFMVmvyxXscp5602YeUPNt9qebyIJoFCxOw8xQE+grMwtA1G48ovMlJYUyf4 0/fF+cK9ylSWT5jg9FtZYNXPDJ16Yi8inKKjbfyrbvJyADTag/0YR4meyeu2ZUyGpA1q RG6zuBuVdenMpq3vXZq1YfWNjpphqhp/5Wl7WR6OJCdxuY/RpSyk1/OauIuxvtkwm3iJ L9LQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id mm20si967151pjb.85.2022.02.21.23.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 23:42:11 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A567E2DA92; Mon, 21 Feb 2022 23:41:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbiBVHmD (ORCPT + 99 others); Tue, 22 Feb 2022 02:42:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbiBVHl7 (ORCPT ); Tue, 22 Feb 2022 02:41:59 -0500 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F022D5DFE; Mon, 21 Feb 2022 23:34:44 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=haoxu@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0V5By.4w_1645515280; Received: from 30.226.12.35(mailfrom:haoxu@linux.alibaba.com fp:SMTPD_---0V5By.4w_1645515280) by smtp.aliyun-inc.com(127.0.0.1); Tue, 22 Feb 2022 15:34:41 +0800 Message-ID: <9cd3cc84-a2a0-a827-3fb8-bd2928eabd28@linux.alibaba.com> Date: Tue, 22 Feb 2022 15:34:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v2 4/4] io_uring: pre-increment f_pos on rw Content-Language: en-US To: Dylan Yudaken , Jens Axboe , Pavel Begunkov , io-uring@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com References: <20220221141649.624233-1-dylany@fb.com> <20220221141649.624233-5-dylany@fb.com> From: Hao Xu In-Reply-To: <20220221141649.624233-5-dylany@fb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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-kernel@vger.kernel.org On 2/21/22 22:16, Dylan Yudaken wrote: > In read/write ops, preincrement f_pos when no offset is specified, and > then attempt fix up the position after IO completes if it completed less > than expected. This fixes the problem where multiple queued up IO will all > obtain the same f_pos, and so perform the same read/write. > > This is still not as consistent as sync r/w, as it is able to advance the > file offset past the end of the file. It seems it would be quite a > performance hit to work around this limitation - such as by keeping track > of concurrent operations - and the downside does not seem to be too > problematic. > > The attempt to fix up the f_pos after will at least mean that in situations > where a single operation is run, then the position will be consistent. > It's a little bit weird, when a read req returns x bytes read while f_pos moves ahead y bytes where x isn't equal to y. Don't know if this causes problems..