Re: [Nbd] [PATCH 1/6] block: export blkdev_reread_part()
- To: Ming Lei <ming.lei@...1301...>
- Cc: Jens Axboe <axboe@...161...>, "nbd-general@lists.sourceforge.net" <nbd-general@lists.sourceforge.net>, linux-s390@...25..., Stefan Haberland <stefan.haberland@...1296...>, Sebastian Ott <sebott@...1294...>, Linux Kernel Mailing List <linux-kernel@...25...>, Jarod Wilson <jarod@...696...>, Christoph Hellwig <hch@...1270...>, Fabian Frederick <fabf@...1980...>, Alexander Viro <viro@...1300...>, David Herrmann <dh.herrmann@...17...>, Tejun Heo <tj@...1285...>, Andrew Morton <akpm@...133...>
- Subject: Re: [Nbd] [PATCH 1/6] block: export blkdev_reread_part()
- From: Christoph Hellwig <hch@...1270...>
- Date: Mon, 6 Apr 2015 07:50:48 -0700
- Message-id: <20150406145048.GC2703@...1270...>
- In-reply-to: <CACVXFVP-rokGRrMus_QXju+MVzFPTaFC45oZBe2PEBfbid8nmQ@...18...>
- References: <1428218688-4092-1-git-send-email-ming.lei@...1301...> <1428218688-4092-2-git-send-email-ming.lei@...1301...> <20150405161241.GB16886@...1270...> <CACVXFVP-rokGRrMus_QXju+MVzFPTaFC45oZBe2PEBfbid8nmQ@...18...>
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.
Reply to: