From patchwork Mon Sep 27 22:25:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 213522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8RMR18O029751 for ; Mon, 27 Sep 2010 22:27:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760272Ab0I0W0p (ORCPT ); Mon, 27 Sep 2010 18:26:45 -0400 Received: from cantor.suse.de ([195.135.220.2]:45595 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760265Ab0I0W0o (ORCPT ); Mon, 27 Sep 2010 18:26:44 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 0565F94BD0; Tue, 28 Sep 2010 00:26:42 +0200 (CEST) Received: by quack.suse.cz (Postfix, from userid 10005) id D11682B1CAE; Tue, 28 Sep 2010 00:25:48 +0200 (CEST) Date: Tue, 28 Sep 2010 00:25:48 +0200 From: Jan Kara To: Cesar Eduardo Barros Cc: Andrew Morton , linux-kernel@vger.kernel.org, Jan Kara , Jens Axboe , Chris Mason , linux-btrfs@vger.kernel.org, Alexander Viro , linux-fsdevel@vger.kernel.org, stable@kernel.org, Jens Axboe , =?utf-8?Q?Micha=C5=82?= Piotrowski , Chuck Ebbert , kernel@lists.fedoraproject.org Subject: Re: Dirtiable inode bdi default != sb bdi btrfs Message-ID: <20100927222548.GG3610@quack.suse.cz> References: <4C9AA546.6050201@cesarb.net> <20100923123849.8975fe47.akpm@linux-foundation.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100923123849.8975fe47.akpm@linux-foundation.org> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 27 Sep 2010 22:27:02 +0000 (UTC) diff --git a/fs/inode.c b/fs/inode.c index 8646433..e415be4 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -172,15 +172,21 @@ int inode_init_always(struct super_block *sb, struct inode *inode) mapping->writeback_index = 0; /* - * If the block_device provides a backing_dev_info for client - * inodes then use that. Otherwise the inode share the bdev's - * backing_dev_info. + * If the filesystem provides a backing_dev_info for client inodes + * then use that. Otherwise inodes share default_backing_dev_info. */ - if (sb->s_bdev) { - struct backing_dev_info *bdi; - - bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info; - mapping->backing_dev_info = bdi; + if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) { + /* + * Catch cases where filesystem might be bitten by using s_bdi + * instead of sb->s_bdev. Can be removed in 2.6.38. + */ + if (sb->s_bdev) { + struct backing_dev_info *bdi = + sb->s_bdev->bd_inode->i_mapping->backing_dev_info; + WARN(bdi != sb->s_bdi, "s_bdev bdi %s != s_bdi %s\n", + bdi->name, sb->s_bdi->name); + } + mapping->backing_dev_info = sb->s_bdi; } inode->i_private = NULL; inode->i_mapping = mapping;