Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1376574imu; Wed, 9 Jan 2019 17:26:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN75uwx/B/1aKf6QolbCPrDZAayzUJHshey6zzfWG+QE5FgcBxwp+IH/5al2U++j6rkCcXyT X-Received: by 2002:a63:cc4e:: with SMTP id q14mr7417183pgi.291.1547083617633; Wed, 09 Jan 2019 17:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547083617; cv=none; d=google.com; s=arc-20160816; b=zPdqxRR2n2rgv8QQdXLYALMqPlhk9eoMPGTd2jSO2427mfjJfUJN1Aq+5iJ/q/OL+N g/3PGXslOyhJaYnRUk7VJXrZVKsIbC5pm2XDBEnuPqRsun7P36EQOFra3yh3UhobBRey Op68ak6aFnwRMMsJCeeH46w+Y5eWXvKgutg+wVRLk4Ngm30Vkrhw92wXyHp+L6v6ypzm GHGEwzfCbWGbWQtAneveAH4fDtkqvYI0GD3SK+N4k4xUpRhZxNNjqowsObw6/aP9aK4D sEmQyjuTZQt/tDZCn8zHlYWSAae469JqcXDmRGfogRFEUJsGjd/UZUR5P4uGfZLmegpr BGtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature; bh=BgvlnKDUtC4qIhVYdgUKnPKKhXoQx4BmJ8JgH/bZm+8=; b=BA6Bx7wPVHLIUQI0kdQvHzzkpJodRhjOOhoTUd72wjeyxbGotx+os/VNKNOyj0YBAB JSmJJyN+0ZkAN5AUhkWUBgDv+zMoiG5BmFgp5wWZD/nguKtGSse+c1Cc7aKuv15KQ4lC YiPoQx+IhTXsv27VOkOc/SRgsN7shdxz0Bhl6moiwtEpDvE3dn5nqKZVIKRImBU0T9DA xLwybp2rse3GaER8zIFHihTlDufY196VpwGLgfeSjR0GfnE3C7JDtJoaxdWU6/v4fDxr +ZYNyJcfbu/6nVtOhQyUMC735ZIYNQMw1sk3xSYsMVk7WIRPU9NQYCoQs/HcOTnJZWc9 KWiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ruy7sYtr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si7245263plo.422.2019.01.09.17.26.41; Wed, 09 Jan 2019 17:26:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ruy7sYtr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbfAJBZe (ORCPT + 99 others); Wed, 9 Jan 2019 20:25:34 -0500 Received: from mail-oi1-f176.google.com ([209.85.167.176]:33722 "EHLO mail-oi1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726590AbfAJBZe (ORCPT ); Wed, 9 Jan 2019 20:25:34 -0500 Received: by mail-oi1-f176.google.com with SMTP id c206so8026130oib.0 for ; Wed, 09 Jan 2019 17:25:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=BgvlnKDUtC4qIhVYdgUKnPKKhXoQx4BmJ8JgH/bZm+8=; b=ruy7sYtr8I1L0HS2zH4AmkrwgDUm+MjXxn9Aw12LKA3hdMjELGJQwuH5S27MZr+i3A 98kLTeFCAizKMGHAm7Hv7z4VhpHZEViZAbqzZHF8Yhau3amvxCEebu+Z0cQKXv6frmm8 HjN2+ph674rwJir04i2omwJd4D6mkICasR5nrKQYTaV+mA/qV/hPBDFmTogEAql6sKsj apgGBfn4LhgCnnW67oaj6DZ1N//T4DFPVVcOy04wNWgSPTzjA4mQJN38KGEiLx/XLRgu lpfRSYF9rEG1GG2QXdmB/6MFpmTcKItSxm//RRU9M3JWRFZjie+NArV6+q1WZJKxMuWR Zpww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BgvlnKDUtC4qIhVYdgUKnPKKhXoQx4BmJ8JgH/bZm+8=; b=sTCV+dj+fMQ5jFl45gASNNzcq1aBYy/92tUe8APJ82njzMgwuBESylLDc7jf2lXntp Vv11AQ3GpbKNr2yT/f5c+mxQFvlMwAl+dGEvES38+3obiBNEsFDChfhBi++LpbtvWUJG IFz1OB780TqyIzPT/sC+oS10QdDQghu3eVO1TbzOVj0awOIsL5hSSCii3KOYfiYulxGd Znof8shjaFqCWPKUawoy4/KCFJjsLz6Evvj0wWFFmcv1jHwgZZCYvjqfF7Kymh6NMzxo aQaUWJBKRaxNilxND1L45M0/mtia4Ya4T7riiLDBOslgqppcUnK98m8w80rjYI0IMK3h Kv4w== X-Gm-Message-State: AJcUukd2Yqja1NxOr9dFEFVwkId+2ZQNHteyqozriBE6jgl4LZjYNEct tioBRlBLJban/GYjL00NEgxjFgVNSLLr93oUi16fGOb1 X-Received: by 2002:aca:b7c2:: with SMTP id h185mr5538721oif.298.1547083532985; Wed, 09 Jan 2019 17:25:32 -0800 (PST) MIME-Version: 1.0 From: james harvey Date: Wed, 9 Jan 2019 20:25:22 -0500 Message-ID: Subject: Interpreting /sys/block//{,}/discard_alignment To: kernel list , martin.petersen@oracle.com, jaxboe@fusionio.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block Describes discard_alignment as: "Devices that support discard functionality may internally allocate space in units that are bigger than the exported logical block size. The discard_alignment parameter indicates how many bytes the beginning of the device is offset from the internal allocation unit's natural alignment." Q1 - I'm hoping you can clarify how this should be interpreted. I originally took this to mean the number of bytes into the first discard_granularity block that the partition resides at. i.e. If discard_granularity_block is 128MB, and partition 1 starts at sector 2048 with 512 byte sectors, that this should return 2048*512=1048576 (1MB.) However, LVM thin volumes (using device mapper thin pools) are seeming to give the number of bytes left in the first discard_granularity block at the beginning of the partition. i.e. Returning discard_granularity of 128 * 1024 * 1024 minus the start of the partition 2048 * 512, or 133169152. (This is if the thin volume is created with a chunk size of 128MB.) Q2 - At https://lkml.org/lkml/2018/12/5/1693 --- I saw you recently said "... there are not many devices that actually report a non-zero discard alignment..." Does this mean that every filesystem needs to look at the partition table to determine its correct value on its own, rather than using discard_alignment?