From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753331AbbDFOuv (ORCPT ); Mon, 6 Apr 2015 10:50:51 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:55946 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbbDFOut (ORCPT ); Mon, 6 Apr 2015 10:50:49 -0400 Date: Mon, 6 Apr 2015 07:50:48 -0700 From: Christoph Hellwig To: Ming Lei Cc: Christoph Hellwig , Jens Axboe , Linux Kernel Mailing List , Tejun Heo , Andrew Morton , Alexander Viro , Jarod Wilson , David Herrmann , Markus Pargmann , "nbd-general@lists.sourceforge.net" , Stefan Haberland , Sebastian Ott , Fabian Frederick , linux-s390@vger.kernel.org Subject: Re: [PATCH 1/6] block: export blkdev_reread_part() Message-ID: <20150406145048.GC2703@infradead.org> References: <1428218688-4092-1-git-send-email-ming.lei@canonical.com> <1428218688-4092-2-git-send-email-ming.lei@canonical.com> <20150405161241.GB16886@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 06, 2015 at 12:40:12AM +0800, Ming Lei wrote: > > int blkdev_reread_part(struct block_device *bdev) > > { > > if (!mutex_trylock(&bdev->bd_mutex)) > > return -EBUSY; > > blkdev_reread_part_nolock(bdev); > > mutex_unlock(&bdev->bd_mutex); > > } > > Yes, it is more clean, but with extra acquiring lock cost for the > failure cases, especially when we replace trylock with mutex_lock(). It's just a few fairly trivial checks, so 'm not really worried about it, especially given that blkdev_reread_part isn't called from a fast path.