From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 6 Apr 2015 07:50:48 -0700 From: Christoph Hellwig 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: Sender: linux-kernel-owner@vger.kernel.org List-Archive: List-Post: 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 List-ID: 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.