Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4112553yba; Tue, 9 Apr 2019 11:24:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhdhiHu1uLahJdGfEcXOo/vzKnl95qq4B3WwnRdlN3s5X3epI/KqDkSvywTvkkTcOdfihV X-Received: by 2002:a65:64d3:: with SMTP id t19mr36000142pgv.57.1554834274571; Tue, 09 Apr 2019 11:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554834274; cv=none; d=google.com; s=arc-20160816; b=EMV6d0o+mtc7W2lvWoc9ZGG65IxqMWQN7lfXUQvH7cK+VvUeW0nB/e3j9pgPObYReH B8jUnex1HY0rFmz3txX/5PUr5WU07HmU4IcE6PhQfwtZ+dBpx2R2tfNyEZQY3OtmqdBO ZiD+3zVbDcgQxM60PI7L8C9UBqbC4UMQPQ2evgVlMPxXvnITfGBJGEqMhJyBvp52nM9o bUCK3OHQkGKfIDAHyl9dN1oEQfFVpnbRqqaaGCYfS+lWwM0ClKj/2AhlPES/uZOlKqiv 0PuO/AVa/TJc+g3WYcxS8EdLL2HN0kwjSsjwsRa+Oe0r9HoBlEGuHfVqw6yOELokVEXM QRkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=PNVquwwp98grAeY4p/OsTz4uwPvJY4QzfDrrKIhwckI=; b=vhK/80ZxVf2i01e3QEsl34BnGwSfa8FwESR0DJHj+fEhd4zqa1fV7uiodKm5YRGaZ5 rB4Kmlz/8J/EIIssRngl3AL1fN9gemB6VAU40OGS67P/SjYdR/48pxJ1yNaUc/LWHi8+ mhjs0cbuw8i9gan0iR5BpQcD0sPIChpNGIII49c+Ij19OR9nRrIhtSpIEIPuyRnSaebs i9xPJAbjdIeNGpajX0gfHC5tqR5Sz/bHZSNaZgSOvPa50Ld4wjmViDehmeqT0myptQlY plCQftmc0dHEYOf7kB7qapMobG0qXU5bce04/9WN4RDZH6vQpIdLaPAHgUgLFK2VcY7x 9x6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=mAQdepYM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l62si21339751pgd.168.2019.04.09.11.24.17; Tue, 09 Apr 2019 11:24:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=mAQdepYM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfDISXk (ORCPT + 99 others); Tue, 9 Apr 2019 14:23:40 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36794 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726431AbfDISXj (ORCPT ); Tue, 9 Apr 2019 14:23:39 -0400 Received: by mail-pl1-f196.google.com with SMTP id ck15so9911009plb.3 for ; Tue, 09 Apr 2019 11:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PNVquwwp98grAeY4p/OsTz4uwPvJY4QzfDrrKIhwckI=; b=mAQdepYMqjV59NADmqDN+b5fsNEXJA6d5WVSejU51qXmU+EmyjMCVQT7XpIteEIsb7 Fe3SIIn3SUBYkQTlbOkGFxkXH+sGJPeqPnXaW4a3fP002SGN+fGRlfj/2Mej3A8Dt/z3 AYSGYkKFlbbra+abb4N6+3TaKIFw0jZDK7+JBD+hhPuLbeucP8VNCgRydYddPlnJN4WO S0u8VBjOLOd33eGZME9tkfPrSA3ijx6YeRg8TwsqpnhDLMlMLs9kl8hjBrG6H6VV3vqb 7vQaerBJZPoFsjAjf6ZSdWLT9k0cNscNSyNCnp9LINTH9ayPnMBAKLylrfSvPm7gV2Dw 9Xxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PNVquwwp98grAeY4p/OsTz4uwPvJY4QzfDrrKIhwckI=; b=FGOwxsQ1Y4PmCk78yQwngQ4bTv7zi4kwhrAFLRh6Z03Gd7u4MZW7oGT1zQ53gCb1pR D/7XO2JHfwVUqqxPjQq1iHRiJQJSMiKZ0eGPkwNhB3BT8u9yXsbXSXsWoJoGoetDjr/D 8zJ/+ESLnMg/SX/h5iNc9bbpfuY41TTcUXuu24HCksV8mPDFJOwE4rNuzF+CTK+wxSaI raZ9G2qxSriJzEK97UfdjIGDt9Ga+kUQa/MvefRFxMV6Cf7trsjE/o45wI03xcdpN7k+ 3ML5Ivb/FQomV7QCIKTvLl0t4eu8rMEjEnTa2ank2OrPKYtNlPBVzUcSl/CFtZzBl8J4 iY2A== X-Gm-Message-State: APjAAAXvg2qLefgzf0kv3H4j83LjJ+cccAiMkzUnCSo6ff8d/w5cjnYn 28AU6GkKHv9rueUBl26T+SF71Iycya8UQg== X-Received: by 2002:a17:902:2e83:: with SMTP id r3mr38653676plb.153.1554834217882; Tue, 09 Apr 2019 11:23:37 -0700 (PDT) Received: from [192.168.1.121] (66.29.188.166.static.utbb.net. [66.29.188.166]) by smtp.gmail.com with ESMTPSA id j28sm66715725pgb.46.2019.04.09.11.23.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 11:23:36 -0700 (PDT) Subject: Re: [PATCH] io_uring: add support for barrier fsync To: Christoph Hellwig Cc: linux-fsdevel , "linux-block@vger.kernel.org" , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org References: <7c7276e4-8ffa-495a-6abf-926a58ee899e@kernel.dk> <20190409181742.GA24925@infradead.org> From: Jens Axboe Message-ID: <5f8d9644-9e8f-c9d2-611e-4b144c62539c@kernel.dk> Date: Tue, 9 Apr 2019 12:23:34 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190409181742.GA24925@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/9/19 12:17 PM, Christoph Hellwig wrote: > On Tue, Apr 09, 2019 at 10:27:43AM -0600, Jens Axboe wrote: >> It's a quite common use case to issue a bunch of writes, then an fsync >> or fdatasync when they complete. Since io_uring doesn't guarantee any >> type of ordering, the application must track issued writes and wait >> with the fsync issue until they have completed. >> >> Add an IORING_FSYNC_BARRIER flag that helps with this so the application >> doesn't have to do this manually. If this flag is set for the fsync >> request, we won't issue it until pending IO has already completed. > > I think we need a much more detailed explanation of the semantics, > preferably in man page format. > > Barrier at least in Linux traditionally means all previously submitted > requests have finished and no new ones are started until the > barrier request finishes, which is very heavy handed. Is that what > this is supposed to do? If not what are the exact guarantees vs > ordering and or barrier semantics? The patch description isn't that great, and maybe the naming isn't that intuitive either. The way it's implemented, the fsync will NOT be issued until previously issued IOs have completed. That means both reads and writes, since there's no way to wait for just one. In terms of semantics, any previously submitted writes will have completed before this fsync is issued. The barrier fsync has no ordering wrt future writes, no ordering is implied there. Hence: W1, W2, W3, FSYNC_W_BARRIER, W4, W5 W1..3 will have been completed by the hardware side before we start FSYNC_W_BARRIER. We don't wait with issuing W4..5 until after the fsync completes, no ordering is provided there. -- Jens Axboe