[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6ed0e26-e3d4-40c1-b95d-11c5b3b71077@oracle.com>
Date: Thu, 5 Oct 2023 11:24:57 +0100
From: John Garry <john.g.garry@...cle.com>
To: Pankaj Raghav <p.raghav@...sung.com>,
Alan Adamson <alan.adamson@...cle.com>
Cc: axboe@...nel.dk, kbusch@...nel.org, hch@....de, sagi@...mberg.me,
jejb@...ux.ibm.com, martin.petersen@...cle.com, djwong@...nel.org,
viro@...iv.linux.org.uk, brauner@...nel.org,
chandan.babu@...cle.com, dchinner@...hat.com,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-nvme@...ts.infradead.org, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, tytso@....edu, jbongio@...gle.com,
linux-api@...r.kernel.org
Subject: Re: [PATCH 21/21] nvme: Support atomic writes
On 04/10/2023 12:39, Pankaj Raghav wrote:
>> +++ b/drivers/nvme/host/core.c
>> @@ -1926,6 +1926,35 @@ static void nvme_update_disk_info(struct gendisk *disk,
>> blk_queue_io_min(disk->queue, phys_bs);
>> blk_queue_io_opt(disk->queue, io_opt);
>>
>> + atomic_bs = rounddown_pow_of_two(atomic_bs);
>> + if (id->nsfeat & NVME_NS_FEAT_ATOMICS && id->nawupf) {
>> + if (id->nabo) {
>> + dev_err(ns->ctrl->device, "Support atomic NABO=%x\n",
>> + id->nabo);
>> + } else {
>> + u32 boundary = 0;
>> +
>> + if (le16_to_cpu(id->nabspf))
>> + boundary = (le16_to_cpu(id->nabspf) + 1) * bs;
>> +
>> + if (is_power_of_2(boundary) || !boundary) {
note to self/Alan: boundary just needs to be multiple of atomic write
unit max, and not necessarily a power-of-2
>> + blk_queue_atomic_write_max_bytes(disk->queue, atomic_bs);
>> + blk_queue_atomic_write_unit_min_sectors(disk->queue, 1);
>> + blk_queue_atomic_write_unit_max_sectors(disk->queue,
>> + atomic_bs / bs);
> blk_queue_atomic_write_unit_[min| max]_sectors expects sectors (512 bytes unit)
> as input but no conversion is done here from device logical block size
> to SECTORs.
Yeah, you are right. I think that we can just use:
blk_queue_atomic_write_unit_max_sectors(disk->queue,
atomic_bs >> SECTOR_SHIFT);
Thanks,
John
>> + blk_queue_atomic_write_boundary_bytes(disk->queue, boundary);
>> + } else {
>> + dev_err(ns->ctrl->device, "Unsupported atomic boundary=0x%x\n",
>> + boundary);
>> + }
>>
Powered by blists - more mailing lists