From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Tom Yan <tom.ty89@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Tejun Heo <tj@kernel.org>,
Shaun Tancheff <shaun.tancheff@seagate.com>,
Shaun Tancheff <shaun@tancheff.com>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-block@vger.kernel.org
Subject: Re: [RFC] libata-scsi: make sure Maximum Write Same Length is not too large
Date: Fri, 12 Aug 2016 16:56:02 -0400 [thread overview]
Message-ID: <yq1lh01n1ul.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <CAGnHSE=E1Bj99EciXrDS31n4Q4VcRL0sDJ2t4ynx0bHgp5RNtw@mail.gmail.com> (Tom Yan's message of "Fri, 12 Aug 2016 13:02:42 +0800")
>>>>> "Tom" == Tom Yan <tom.ty89@gmail.com> writes:
Tom,
>> put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM / (sector_size / 512), &rbuf[36]);
How many 8-byte ranges fit in a 4096-byte sector?
Tom> So were you trying to pointing out something I am still missing, or
Tom> were you merely confirming I was right?
I suggest you drop ATA_MAX_TRIM_RNUM and do:
enum {
ATA_TRIM_BLOCKS_PER_RANGE = 65535, /* 0xffff blocks per range desc. */
ATA_TRIM_RANGE_SIZE_SHIFT = 3, /* range descriptor is 8 bytes */
};
put_unaligned_be64(ATA_TRIM_BLOCKS_PER_RANGE *
sector_size >> ATA_TRIM_RANGE_SIZE_SHIFT, &rbuf[36]);
Might be worthwhile to create an ata_max_lba_range_blocks() wrapper.
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2016-08-12 20:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 8:26 [RFC] libata-scsi: make sure Maximum Write Same Length is not too large tom.ty89
2016-08-11 17:04 ` Shaun Tancheff
2016-08-11 21:17 ` Tom Yan
2016-08-12 1:34 ` Martin K. Petersen
2016-08-12 5:02 ` Tom Yan
2016-08-12 20:56 ` Martin K. Petersen [this message]
2016-08-12 21:49 ` Shaun Tancheff
2016-08-12 22:15 ` Martin K. Petersen
2016-08-14 9:23 ` Tom Yan
2016-08-16 4:15 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yq1lh01n1ul.fsf@sermon.lab.mkp.net \
--to=martin.petersen@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=shaun.tancheff@seagate.com \
--cc=shaun@tancheff.com \
--cc=tj@kernel.org \
--cc=tom.ty89@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox