From patchwork Wed Mar 29 10:56:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9651319 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 7255A602BE for ; Wed, 29 Mar 2017 10:58:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 716EC2844E for ; Wed, 29 Mar 2017 10:58:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66A742846B; Wed, 29 Mar 2017 10:58:19 +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 1BE6E2845D for ; Wed, 29 Mar 2017 10:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932608AbdC2K6I (ORCPT ); Wed, 29 Mar 2017 06:58:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:33776 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756032AbdC2K4b (ORCPT ); Wed, 29 Mar 2017 06:56:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CE6C3ACCA; Wed, 29 Mar 2017 10:56:28 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 3631C1E1253; Wed, 29 Mar 2017 12:56:26 +0200 (CEST) From: Jan Kara To: Cc: linux-block@vger.kernel.org, Christoph Hellwig , Jan Kara Subject: [PATCH 05/25] fs: Get proper reference for s_bdi Date: Wed, 29 Mar 2017 12:56:03 +0200 Message-Id: <20170329105623.18241-6-jack@suse.cz> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170329105623.18241-1-jack@suse.cz> References: <20170329105623.18241-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. Signed-off-by: Jan Kara Reviewed-by: Christoph Hellwig --- 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; }