From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754139Ab3KEA47 (ORCPT ); Mon, 4 Nov 2013 19:56:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12895 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819Ab3KEA45 (ORCPT ); Mon, 4 Nov 2013 19:56:57 -0500 Date: Mon, 4 Nov 2013 19:56:54 -0500 From: Mike Snitzer To: Mikulas Patocka Cc: axboe@kernel.dk, kmo@daterainc.com, dm-devel@redhat.com, agk@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH for-next] dm: fix missing bi_remaining accounting Message-ID: <20131105005654.GA22356@redhat.com> References: <20131101135931.GA22903@redhat.com> <5273C2B8.5030608@kernel.dk> <20131104152001.GA12398@redhat.com> <20131104160336.GB12398@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 04 2013 at 12:49pm -0500, Mikulas Patocka wrote: > > > On Mon, 4 Nov 2013, Mike Snitzer wrote: > > > On Mon, Nov 04 2013 at 10:25am -0500, > > Mikulas Patocka wrote: > > > > > > > > > > > On Mon, 4 Nov 2013, Mike Snitzer wrote: > > > > > > > On Mon, Nov 04 2013 at 10:06am -0500, > > > > Mikulas Patocka wrote: > > > > > > > > > > The code uses atomic_inc for restoration of bi_remaining. This patch > > > > > changes it to atomic_set(1) to avoid an interlocked instruction. In the > > > > > target's bi_endio routine we are sure that bi_remaining is zero > > > > > (otherwise, the bi_endio routine wouldn't be called) and there are no > > > > > concurrent users of the bio, so we can replace atomic_inc with > > > > > atomic_set(1). > > > > > > > > This isn't DM-specific. Shouldn't the other places in the tree that use > > > > atomic_inc on bi_remaining should really be converted at the same time? > > > > > > There is no 'atomic_inc.*bi_remaining' in other drivers. > > > > Wrong. I know btrfs has at least one. As does bcache afaik. > > grep -r 'atomic_inc.*bi_remaining' * yilds no hits in btrfs or bcache (on > git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git , > branch remotes/origin/for-next). It only finds > drivers/md/dm-cache-target.c, drivers/md/dm-verity.c, > drivers/md/dm-snap.c, drivers/md/dm-thin.c. Maybe in other git trees there > are more cases of this. Here is the btrfs one I was thinking of from Chris: https://patchwork.kernel.org/patch/3123121/ Should probably make its way into linux-block.git, Jens?