Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1616452
| From | Bart Van Assche <Bart.VanAssche@sandisk.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF |
| Date | 2017-04-05 02:00 +0200 |
| Message-ID | <tsGwF-3hw-5@gated-at.bofh.it> (permalink) |
| References | <tfvz4-7vd-11@gated-at.bofh.it> <tfx7Q-gn-21@gated-at.bofh.it> <tfx7Q-gn-19@gated-at.bofh.it> <tfGE9-6YX-5@gated-at.bofh.it> <tsGdj-39m-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 2017-04-04 at 19:35 -0400, Martin K. Petersen wrote:
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index fb9b4d29af0b..6084c415c070 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2102,6 +2102,16 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp,
>
> #define READ_CAPACITY_RETRIES_ON_RESET 10
>
> +static bool sd_addressable_capacity(u64 lba, unsigned int sector_size)
> +{
> + u64 last_sector = lba + 1ULL << ilog2(sector_size) - 9;
> +
> + if (sizeof(sector_t) == 4 && last_sector > 0xffffffffULL)
> + return false;
> +
> + return true;
> +}
Hello Martin,
How about replacing 0xffffffffULL with U32_MAX, adding parentheses in the
last_sector computation to make clear that + and - have precedence over <<
and adding a comment aboveĀ sd_addressable_capacity() that explains its
purpose and also that the shift operation must not be replaced with a call
to logical_to_sectors()? Otherwise this patch looks fine to me.
Thanks,
Bart.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-04-05 01:40 +0200 Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF Bart Van Assche <Bart.VanAssche@sandisk.com> - 2017-04-05 02:00 +0200
csiph-web