From patchwork Fri Aug 18 19:27:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9909825 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 2173E603B5 for ; Fri, 18 Aug 2017 19:28:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12E4528D3F for ; Fri, 18 Aug 2017 19:28:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 051DC28D51; Fri, 18 Aug 2017 19:28:33 +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 958FC28D4D for ; Fri, 18 Aug 2017 19:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750993AbdHRT1s (ORCPT ); Fri, 18 Aug 2017 15:27:48 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:38648 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204AbdHRT1r (ORCPT ); Fri, 18 Aug 2017 15:27:47 -0400 Received: by mail-pg0-f51.google.com with SMTP id t80so42417701pgb.5 for ; Fri, 18 Aug 2017 12:27:47 -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=TuKtT2tkKXm6LERWkCaCHrSkZ6ULY4yiMISVeOSXzPA=; b=jvCqH8ihtFJB2IvC9zy0cKxSkHUJHx4Ko3gnstFO/kJPQa1QH/HIM0faFn4DVo4mF+ cHhbS/+yhAkp8VosO2J86U3CZ3IOfH0AenTLFdnvT6h9JgSM2EDf7XOAtJMVOuCJw5lg e+gBg8ACSxBgPgnwIEOQnuuMMJzcHm9qLzTp+HXLQHeNeQNxb+rXllhvuhPfuIMQLKia yW0ZqE5acNQ12CitZtmu5Gvd9Aow68DDZ7bRa16eVFwA10pp4L2ZVhHJZ+9Xcf4dXH/r h/4lyF2VihEtL5szG4QPbYvI1bijuXx+T1eX/Qhxv2CbUea+o3HLIRf4Vx/R3rmI0aG1 14RA== 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=TuKtT2tkKXm6LERWkCaCHrSkZ6ULY4yiMISVeOSXzPA=; b=X8xf4vZz7mnSnnY4hbFca1QLQMLJEthu76Jo7JbVfWTfeY/JBCFM3Jo/W9IOmRIjuR TzqR7Mqz4h9gFa/QxeDOcs8UB9L/Mf8/s6FRZ9YEfYZOkUpeVPijIv1B1jem/phUtQjg ndxWMHjx5J2qmoRuuiItjmBJjRsh0ZJM1kofDFwZZCu0bxtLtEhuF5/c+B4ljcR+677p P3NnzPhF0FO3jrXZb+AQPBmw6D9gCWH/U8XLGsM/J0tVqCn5Xnt6mXt3NRlJT2OLFY7O KpdWXeUF9kgEWXzzX9uTotpcCvszNPDnlIyjxhjy23oUUqtp6VnDc6zTSr3yANzZZZP6 UGfw== X-Gm-Message-State: AHYfb5gA4EpTR8XIa31DN/2TYyXREtPmtwGQvHc07AwcSp5B4sseW+Q+ CcATLJE6vmj+GIb9nDB4TA== X-Received: by 10.99.119.195 with SMTP id s186mr741046pgc.187.1503084467323; Fri, 18 Aug 2017 12:27:47 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::7:7002]) by smtp.gmail.com with ESMTPSA id d3sm9972633pgf.75.2017.08.18.12.27.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:27:46 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: kernel-team@fb.com, Hannes Reinecke , Ming Lei , Karel Zak Subject: [PATCH v2 3/3] loop: always return block size in LOOP_GET_STATUS Date: Fri, 18 Aug 2017 12:27:37 -0700 Message-Id: <1cd56dabbd92fd4b5936577048aa117ae85d74a3.1503084216.git.osandov@fb.com> 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 When I was writing a test for the new loop device block size functionality, I noticed a couple of issues with how LOOP_GET_STATUS handles the block size: - lo_init[0] is never filled in with the logical block size we previously set - lo_flags returned from LOOP_GET_STATUS will have LO_FLAGS_BLOCKSIZE set if we previously called LOOP_SET_STATUS with LO_FLAGS_BLOCKSIZE set, which doesn't really mean anything Instead, for LOOP_GET_STATUS, let's always fill in lo_init[0] and set the LO_FLAGS_BLOCKSIZE flag to indicate we support it. Signed-off-by: Omar Sandoval Reviewed-by: Hannes Reinecke --- drivers/block/loop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 94227a327ce2..a1ac50bc4812 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1224,7 +1224,7 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info) info->lo_rdevice = huge_encode_dev(lo->lo_device ? stat.rdev : stat.dev); info->lo_offset = lo->lo_offset; info->lo_sizelimit = lo->lo_sizelimit; - info->lo_flags = lo->lo_flags; + info->lo_flags = lo->lo_flags | LO_FLAGS_BLOCKSIZE; memcpy(info->lo_file_name, lo->lo_file_name, LO_NAME_SIZE); memcpy(info->lo_crypt_name, lo->lo_crypt_name, LO_NAME_SIZE); info->lo_encrypt_type = @@ -1234,6 +1234,7 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info) memcpy(info->lo_encrypt_key, lo->lo_encrypt_key, lo->lo_encrypt_key_size); } + LO_INFO_BLOCKSIZE(info) = queue_logical_block_size(lo->lo_queue); return 0; }