From patchwork Wed Apr 12 10:24:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9676977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C518260325 for ; Wed, 12 Apr 2017 10:25:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6CFB285D6 for ; Wed, 12 Apr 2017 10:25:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABC6D285E8; Wed, 12 Apr 2017 10:25:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 719A9285D6 for ; Wed, 12 Apr 2017 10:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752599AbdDLKZT (ORCPT ); Wed, 12 Apr 2017 06:25:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:40159 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752537AbdDLKZE (ORCPT ); Wed, 12 Apr 2017 06:25:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4FDD4AEAE; Wed, 12 Apr 2017 10:25:03 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id AA7D41E319C; Wed, 12 Apr 2017 12:25:02 +0200 (CEST) From: Jan Kara To: Jens Axboe Cc: , , Jan Kara Subject: [PATCH 05/25] fs: Get proper reference for s_bdi Date: Wed, 12 Apr 2017 12:24:29 +0200 Message-Id: <20170412102449.16901-6-jack@suse.cz> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170412102449.16901-1-jack@suse.cz> References: <20170412102449.16901-1-jack@suse.cz> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP So far we just relied on block device to hold a bdi reference for us while the filesystem is mounted. While that works perfectly fine, it is a bit awkward that we have a pointer to a refcounted structure in the superblock without proper reference. So make s_bdi hold a proper reference to block device's BDI. No filesystem using mount_bdev() actually changes s_bdi so this is safe and will make bdev filesystems work the same way as filesystems needing to set up their private bdi. Reviewed-by: Christoph Hellwig Signed-off-by: Jan Kara --- fs/super.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/super.c b/fs/super.c index 0f51a437c269..e267d3a00144 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1054,12 +1054,9 @@ static int set_bdev_super(struct super_block *s, void *data) { s->s_bdev = data; s->s_dev = s->s_bdev->bd_dev; + s->s_bdi = bdi_get(s->s_bdev->bd_bdi); + s->s_iflags |= SB_I_DYNBDI; - /* - * We set the bdi here to the queue backing, file systems can - * overwrite this in ->fill_super() - */ - s->s_bdi = bdev_get_queue(s->s_bdev)->backing_dev_info; return 0; }