From patchwork Thu Aug 24 07:03:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9919139 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 4512060327 for ; Thu, 24 Aug 2017 07:03:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3691E28B48 for ; Thu, 24 Aug 2017 07:03:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B6E128B65; Thu, 24 Aug 2017 07:03:55 +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,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham 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 C55AA28B48 for ; Thu, 24 Aug 2017 07:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227AbdHXHDy (ORCPT ); Thu, 24 Aug 2017 03:03:54 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:38803 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbdHXHDx (ORCPT ); Thu, 24 Aug 2017 03:03:53 -0400 Received: by mail-pg0-f43.google.com with SMTP id m133so12451466pga.5 for ; Thu, 24 Aug 2017 00:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=HbAkCmQjNzlfwKAnsm76C+BND0zC4il6wsTVln1vFjU=; b=KqUi8rM979Yz9pml2Gp8SpNy08UqjKq4f+PfoAOkJymFVTv/chWPINoXD07iAizrfU DZgHk9kKlAWVgoAFvmRZ2KXSnO5WfpdCS4KACqnrfVrLrv1i6w5hqyoXqXPDdRN8tNjH z/+U5CP6v8AUjRXd4atxrP2LCnHgnBDdNa7cEULIFPgLS/whHyEebpRy3jqVYdUtmlZ8 WIZkHe2WQuQI+0FiEKjjIQgNyqbgYqwQDifeMd/LHUHWz/K2Y4d3nnVAjJ5xxJBhX8y1 +TpqVLRAX+Fe7wocpHCeCV1G8TXhsPODhnjbKM+Dljh/m2731ktUytv30SlXOiecnyLC 8wxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=HbAkCmQjNzlfwKAnsm76C+BND0zC4il6wsTVln1vFjU=; b=jeTTXop9trhv6crfNpDv45lvZzPNujTn5YkY2n8t1ZEM/PbQhyIxiZ0H5tQGaqMos2 r+AbnVzT2+o1sSqc5Kc4JXrh5WzxFop14yUf5ysr12kENjh0zj/pIxZzvqBQqpUiDtyI ymMpvzJ0/PKi023iRCcBtfOyqG/JX11CGdt+llRrouJ+IdGJ2nYDyA8qkVE7XHihXiXA PGZ98wrObYsnMp44ejAv+xpaeGdMgVez59Q28kRlR2tKHKYte+xf3kQ2R3dEP9mvnNsr vc6hfGh03pnpOp6X4ih5X3uJRcxZBvt0S5I//N7PEJsr9JP6/y+eukVgjRm1eGDmDCRW UQhg== X-Gm-Message-State: AHYfb5hwdXTtbDIGYDJaEuNnKd8gTlqJomqhqwUDMVUe2L4oGNBy4rjh 12nWdK/lwVN1LG0Pj52UvA== X-Received: by 10.98.150.138 with SMTP id s10mr5415444pfk.80.1503558232980; Thu, 24 Aug 2017 00:03:52 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::1:90fd]) by smtp.gmail.com with ESMTPSA id g2sm6187459pgu.86.2017.08.24.00.03.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Aug 2017 00:03:52 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: kernel-team@fb.com, Hannes Reinecke , Ming Lei , Karel Zak , Milan Broz Subject: [PATCH 1/4] loop: get rid of lo_blocksize Date: Thu, 24 Aug 2017 00:03:41 -0700 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: 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 From: Omar Sandoval This is only used for setting the soft block size on the struct block_device once and then never used again. Signed-off-by: Omar Sandoval Reviewed-by: Hannes Reinecke --- drivers/block/loop.c | 10 ++-------- drivers/block/loop.h | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index f321b96405f5..54e091887199 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -573,8 +573,6 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p) mapping = file->f_mapping; mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask); lo->lo_backing_file = file; - lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ? - mapping->host->i_bdev->bd_block_size : PAGE_SIZE; lo->old_gfp_mask = mapping_gfp_mask(mapping); mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); loop_update_dio(lo); @@ -867,7 +865,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, struct file *file, *f; struct inode *inode; struct address_space *mapping; - unsigned lo_blocksize; int lo_flags = 0; int error; loff_t size; @@ -911,9 +908,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, !file->f_op->write_iter) lo_flags |= LO_FLAGS_READ_ONLY; - lo_blocksize = S_ISBLK(inode->i_mode) ? - inode->i_bdev->bd_block_size : PAGE_SIZE; - error = -EFBIG; size = get_loop_size(lo, file); if ((loff_t)(sector_t)size != size) @@ -927,7 +921,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, set_device_ro(bdev, (lo_flags & LO_FLAGS_READ_ONLY) != 0); lo->use_dio = false; - lo->lo_blocksize = lo_blocksize; lo->lo_device = bdev; lo->lo_flags = lo_flags; lo->lo_backing_file = file; @@ -947,7 +940,8 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, /* let user-space know about the new size */ kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE); - set_blocksize(bdev, lo_blocksize); + set_blocksize(bdev, S_ISBLK(inode->i_mode) ? + block_size(inode->i_bdev) : PAGE_SIZE); lo->lo_state = Lo_bound; if (part_shift) diff --git a/drivers/block/loop.h b/drivers/block/loop.h index fecd3f97ef8c..efe57189d01e 100644 --- a/drivers/block/loop.h +++ b/drivers/block/loop.h @@ -48,7 +48,6 @@ struct loop_device { struct file * lo_backing_file; struct block_device *lo_device; - unsigned lo_blocksize; void *key_data; gfp_t old_gfp_mask;