From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de ([213.95.11.211]:36943 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932291AbeFFKS5 (ORCPT ); Wed, 6 Jun 2018 06:18:57 -0400 Date: Wed, 6 Jun 2018 12:26:13 +0200 From: Christoph Hellwig To: David Sterba Cc: Andreas Gruenbacher , cluster-devel@redhat.com, Christoph Hellwig , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v8 03/10] iomap: Complete partial direct I/O writes synchronously Message-ID: <20180606102613.GA11138@lst.de> References: <20180604193123.27655-1-agruenba@redhat.com> <20180604193123.27655-4-agruenba@redhat.com> <20180605121024.t6indzioavvfonxk@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180605121024.t6indzioavvfonxk@twin.jikos.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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.