Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp537495ybk; Wed, 13 May 2020 06:42:45 -0700 (PDT) X-Google-Smtp-Source: APiQypJUX+8KPG+zwLid0QY6OkM8Ri8c5v07yhnFelfvBFuuIXmyBUUxoxxxcMhiCWdFzToDGqfR X-Received: by 2002:a17:906:18e9:: with SMTP id e9mr21681963ejf.140.1589377365607; Wed, 13 May 2020 06:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589377365; cv=none; d=google.com; s=arc-20160816; b=EKdf6/pzFccae7qPNFJ6W7/RiksHkcPfC4QPhaHAZjmz3mcpJlL/HyhQzYjWBYxsrH Z9hfmDQwxHAOTh4BRhjc1nwLPW3zmnbkznn3PrPndA5797ZYOKILtoYZTnr51pjx2wTW ZxGxglPwfx3WwIficHqA51yYbyIUqg8gKYYxtvk8QTd+lQeCgqe31/IQZMgXExcBhMy9 EiNp+0XEANZJjePwKK88nPIndbXwOL0DbsfUxixWulCbcHqCSo4OMyBh8/zBzNZKj3Jy NNWmjMMAjEm6yujuGc+71Ym1z290As5PS8NW4m7W75AeGdac+AL2rbgeNcZpn6vrgGWT l3AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DgaYzMr4at/dBaiZhwCRdQ4/MPv6wjkUvq/fU8vDFyU=; b=NvMw6S9527agtxrJe+BCUr0i3lsOlm9FNBsGFHD2hXuV9ULF0cV4aJR6f5g+8TmLpJ KdPv6MZ6kNExY2Y3pa9l1fvUNu4+T5tcNgX1+VbuL6fL4In7Fx8UeYqSD+soZTvVnqUL oUstZp02lwcUn9jsWtKO/sPiRSRyeFj+3LBdrWqwIIBXfeCQB+u9K/ojdGTWrUYV3SB/ oagkb59zKseViISWrg6novFw4TEuQ5hL0jUkCrB2feBAWHgKsEHxX7HDhB9yLzkeus3D 2nG0HO8JlNsEZWM4Z/y3Sr+ji7efIqPFOhrCqEwSKEr0lh0PtlX5MKrZpK0GfmH36HPs Ai8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=eGCVZxVH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si9416202edu.229.2020.05.13.06.42.22; Wed, 13 May 2020 06:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=eGCVZxVH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388142AbgEMNjt (ORCPT + 99 others); Wed, 13 May 2020 09:39:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388265AbgEMNi6 (ORCPT ); Wed, 13 May 2020 09:38:58 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D101C061A0E for ; Wed, 13 May 2020 06:38:58 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id w7so20953824wre.13 for ; Wed, 13 May 2020 06:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DgaYzMr4at/dBaiZhwCRdQ4/MPv6wjkUvq/fU8vDFyU=; b=eGCVZxVH41xtk/Hjf+/yYBJ2rL1w6wlC3Q0Ug4CbUk3ChWSrV8fzgQX9ykCvUT+WD9 k4TVZ93AvvFeUwiNHWIkVYVGAymD2Gk39up77TJ2y37bP9aBqIS3aqzRrhVmlB8WF7M0 WDt5iLjYWw76K76yNr9+BBY784ZgOP7+9caXVVhTMgrdZ8fkU8Kc4SaUf2qcJEufNd4V rQECv2nuZtoI3PyLMqtZeRkyHn/P0sAzh3uUx1p2MjSKTFvAxy76bwFE0dIYoFBg5PmV 1RajsSLC34y31X7v/094xPxLGacJnioom8pXaoWEHCGPCdXDpj2tEwylNfKY8m3YkA20 uq7w== 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:mime-version:content-transfer-encoding; bh=DgaYzMr4at/dBaiZhwCRdQ4/MPv6wjkUvq/fU8vDFyU=; b=W2KOP6HXdfKwZ8LNW0JxqHlBErcPunqWedpRvtgnEoIv/tx5S5XMhMO4mwm+n7aR4Y sJpS0vRpZ8jk5bbJlVMFlaS/FlXBHI5iVwyagHTuXer5TYOC9aJ5/S6zDwWiJR2AUfpb Mu1YYk8pg9zgVy6y2D2bqcKkg95DscTN9br205UIV+YtL7JuFyxydkAGnwfhOzrzZLMl rFiuOehFRM/v9rqJFWLzUMGrpecGOczVGm9lwlwjfYa9XLX09JSzuy4uT0gBXLXQPGjb OCiEOU6QPdIUDhkXxVzTpkkfmqLWvogdxO0g0PH/zZHscxzT0qsV5QrltQ6S1M7UFQWK 3C2Q== X-Gm-Message-State: AGi0PuZuOjjfe0O9tQq3ZH4wkCkfenxLOlrBbEBEGV37Up19oEhNqmoL fVSdYZMHgSqYnmtQfKN1e1vAsA== X-Received: by 2002:a05:6000:1241:: with SMTP id j1mr30927974wrx.42.1589377136723; Wed, 13 May 2020 06:38:56 -0700 (PDT) Received: from maco2.ams.corp.google.com (a83-162-234-235.adsl.xs4all.nl. [83.162.234.235]) by smtp.gmail.com with ESMTPSA id m6sm26202653wrq.5.2020.05.13.06.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 06:38:55 -0700 (PDT) From: Martijn Coenen To: axboe@kernel.dk, hch@lst.de, ming.lei@redhat.com Cc: narayan@google.com, zezeozue@google.com, maco@google.com, kernel-team@android.com, bvanassche@acm.org, Chaitanya.Kulkarni@wdc.com, jaegeuk@kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Martijn Coenen Subject: [PATCH v5 06/11] loop: Remove figure_loop_size() Date: Wed, 13 May 2020 15:38:40 +0200 Message-Id: <20200513133845.244903-7-maco@android.com> X-Mailer: git-send-email 2.26.2.645.ge9eca65c58-goog In-Reply-To: <20200513133845.244903-1-maco@android.com> References: <20200513133845.244903-1-maco@android.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This function was now only used by loop_set_capacity(). Just open code the remaining code in the caller instead. Reviewed-by: Christoph Hellwig Signed-off-by: Martijn Coenen --- drivers/block/loop.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index c134b3439483..e281a9f03d96 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -245,14 +245,6 @@ static void loop_set_size(struct loop_device *lo, loff_t size) set_capacity_revalidate_and_notify(lo->lo_disk, size, false); } -static void -figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit) -{ - loff_t size = get_size(offset, sizelimit, lo->lo_backing_file); - - loop_set_size(lo, size); -} - static inline int lo_do_transfer(struct loop_device *lo, int cmd, struct page *rpage, unsigned roffs, @@ -1534,10 +1526,13 @@ loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) { static int loop_set_capacity(struct loop_device *lo) { + loff_t size; + if (unlikely(lo->lo_state != Lo_bound)) return -ENXIO; - figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit); + size = get_loop_size(lo, lo->lo_backing_file); + loop_set_size(lo, size); return 0; } -- 2.26.2.645.ge9eca65c58-goog