[PATCH 04/12] block_dev: only write bdev inode on close

Tejun Heo tj at kernel.org
Sun Jan 11 09:32:09 PST 2015


Hello,

On Thu, Jan 08, 2015 at 06:45:25PM +0100, Christoph Hellwig wrote:
> Since "bdi: reimplement bdev_inode_switch_bdi()" the block device code

018a17bdc865 ("bdi: reimplement bdev_inode_switch_bdi()") would be
better.

> writes out all dirty data whenever switching the backing_dev_info for
> a block device inode.  But a block device inode can only be dirtied
> when it is in use, which means we only have to write it out on the
> final blkdev_put, but not when doing a blkdev_get.
> @@ -1464,9 +1469,11 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
>  		WARN_ON_ONCE(bdev->bd_holders);
>  		sync_blockdev(bdev);
>  		kill_bdev(bdev);
> -		/* ->release can cause the old bdi to disappear,
> -		 * so must switch it out first
> +		/*
> +		 * ->release can cause the queue to disappaear, so flush all
                                                         ^^^^^
							 typo
> +		 * dirty data before.
>  		 */
> +		bdev_write_inode(bdev->bd_inode);

Is this an optimization or something necessary for the following
changes?  If latter, maybe it's a good idea to state why this is
necessary in the description?  Otherwise,

 Acked-by: Tejun Heo <tj at kernel.org>

Thanks.

-- 
tejun



More information about the linux-mtd mailing list