From patchwork Tue Aug 22 17:32:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9915829 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 C52BB60381 for ; Tue, 22 Aug 2017 17:33:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE164283ED for ; Tue, 22 Aug 2017 17:33:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A30E0286B7; Tue, 22 Aug 2017 17:33:20 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 49686283ED for ; Tue, 22 Aug 2017 17:33:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752028AbdHVRdR (ORCPT ); Tue, 22 Aug 2017 13:33:17 -0400 Received: from mail-pg0-f43.google.com ([74.125.83.43]:33233 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751877AbdHVRdP (ORCPT ); Tue, 22 Aug 2017 13:33:15 -0400 Received: by mail-pg0-f43.google.com with SMTP id t3so89572355pgt.0 for ; Tue, 22 Aug 2017 10:33:15 -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=nxJgWD/48z7FiXyJkKFntIMpxojeGjggFtaLh9uRYrs=; b=c2ZAOwcmNB6np5+qkgwp4Hc1eES1Ph+s915vD/kDd0dxqYYXZpp3AQCqzrnjRWXo0y 3Dr9jvI/FYkjEyfM/H8OU35mzmMEp9GMhA2sYzVcUm/lO+7LOdhIUggJAkzCwozhSzA+ UVz7yBPBMZqsPPiEMBVjwSPWuH1cQgnHnbsi9bmYOqaCcOamE4xFY+yRTfA5ncuNg6Qu 5vghNE+iz4VWfaS8SQnNgzukyoDDaYTdWkQCiRijsSiiAEDzDgwM/dIGIuvaNK7uGpF2 bCPdC6x69sIVQmkaS/ChSuwSOLJGhS/RgdBlYqUkUXPUt31Wvc1ydD7a/HyLNc0Uidsz TvZQ== 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=nxJgWD/48z7FiXyJkKFntIMpxojeGjggFtaLh9uRYrs=; b=YxcdJzVTj9oglEt8IMikw7QqKZurnQfL0CbdWRGlJZde+bwbObBbuKDn2JCt6eS1A7 YxrgxIcbdoBNlCcjfB8urMj/xWr74rNs55wrSw+u+b3UYXl7SmBA01eQqh6aejHrprTq s30Ob+q5XPWtkrDoITvkDHhVteo5sDY12LO/bO6LXJ8w6nS5gmdMXonAthJPzHwHmjKz dmVKgh/EEWpw5SOqaIIkraQxu8O9dCP0z7diwsVDWiOh2ibXTrRBGKRfgC3/bPuZdeoR 2FCg5WNazDLZ9Pg+hT5+PyWHIjAYytu+bRCRSqdUxwxALHonuLDsSERQg3XKBow23tqW fPCA== X-Gm-Message-State: AHYfb5j7OM0BnovKCBPkKBP7uiLXvDYFBaVzABLqg0JE11J+T2+Qv3NZ gMNjWC8RltYQ+uqP1El41A== X-Received: by 10.99.24.85 with SMTP id 21mr1475787pgy.108.1503423194506; Tue, 22 Aug 2017 10:33:14 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::6:99f5]) by smtp.gmail.com with ESMTPSA id m10sm4920083pgd.62.2017.08.22.10.33.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Aug 2017 10:33:13 -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 v3 2/4] loop: set discard and write zeroes limits in 512 byte sectors Date: Tue, 22 Aug 2017 10:32:59 -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 max_discard_sectors and max_write_zeroes_sectors are in 512 byte sectors, not device sectors. Fixes: f2c6df7dbf9a ("loop: support 4k physical blocksize") Signed-off-by: Omar Sandoval Reviewed-by: Hannes Reinecke --- drivers/block/loop.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 26548e07bc31..a444dc2d5977 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -820,7 +820,6 @@ static void loop_config_discard(struct loop_device *lo) struct file *file = lo->lo_backing_file; struct inode *inode = file->f_mapping->host; struct request_queue *q = lo->lo_queue; - int lo_bits = 9; /* * We use punch hole to reclaim the free space used by the @@ -840,11 +839,8 @@ static void loop_config_discard(struct loop_device *lo) q->limits.discard_granularity = inode->i_sb->s_blocksize; q->limits.discard_alignment = 0; - if (lo->lo_flags & LO_FLAGS_BLOCKSIZE) - lo_bits = blksize_bits(lo->lo_logical_blocksize); - - blk_queue_max_discard_sectors(q, UINT_MAX >> lo_bits); - blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> lo_bits); + blk_queue_max_discard_sectors(q, UINT_MAX >> 9); + blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9); queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); }