From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f195.google.com ([209.85.223.195]:36920 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751729AbeFFLoT (ORCPT ); Wed, 6 Jun 2018 07:44:19 -0400 Received: by mail-io0-f195.google.com with SMTP id s26-v6so7223604ioj.4 for ; Wed, 06 Jun 2018 04:44:19 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20180606102613.GA11138@lst.de> References: <20180604193123.27655-1-agruenba@redhat.com> <20180604193123.27655-4-agruenba@redhat.com> <20180605121024.t6indzioavvfonxk@twin.jikos.cz> <20180606102613.GA11138@lst.de> From: Andreas Gruenbacher Date: Wed, 6 Jun 2018 13:44:18 +0200 Message-ID: Subject: Re: [PATCH v8 03/10] iomap: Complete partial direct I/O writes synchronously To: Christoph Hellwig Cc: David Sterba , cluster-devel , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 6 June 2018 at 12:26, Christoph Hellwig wrote: > On Tue, Jun 05, 2018 at 02:10:24PM +0200, David Sterba wrote: >> On Mon, Jun 04, 2018 at 09:31:16PM +0200, Andreas Gruenbacher wrote: >> > @@ -1062,8 +1063,9 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, >> > if (ret < 0) >> > iomap_dio_set_error(dio, ret); >> > >> > + smp_mb__before_atomic(); >> > if (!atomic_dec_and_test(&dio->ref)) { >> >> The barrier should be documented. I tried to do a quick look around the >> code if it's clear why it's there but it's not. Thanks. > > It doesn't really make sense. smp_mb__before_atomic is for relaxed > atomic operations, which atomic_dec_and_test is not. After re-reading Documentation/core-api/atomic_ops.rst again, I agree it's not needed. There is an example in the documentation that was confusing me. Thanks, Andreas