All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: mchristi@redhat.com, linux-scsi@vger.kernel.org,
	target-devel@vger.kernel.org, socketpair@gmail.com,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/2] target: fix max discard sectors calculation
Date: Tue, 17 May 2016 11:16:38 -0700	[thread overview]
Message-ID: <573B6006.8010206@sandisk.com> (raw)
In-Reply-To: <yq1y479hlmp.fsf@sermon.lab.mkp.net>

On 05/16/2016 12:02 PM, Martin K. Petersen wrote:
>>>>>> "Bart" == Bart Van Assche <bart.vanassche@sandisk.com> writes:
>
> Bart> That's a good catch. But seeing this patch makes me wonder whether
> Bart> this patch introduces a 64-bit division? If so, I'm afraid this
> Bart> patch will make 32-bit users unhappy. Have you considered to use
> Bart> do_div() or >> (ilog2(block_size) - 9) instead? For the latter
> Bart> alternative no 64-bit cast is needed.
>
> Please use logical_to_sectors().

Hello Martin,

For SCSI initiator devices the logical block size is stored in struct 
scsi_device. logical_to_sectors() gets the logical block size from 
struct scsi_device. LIO however stores the logical block size in struct 
se_dev_attrib. If we want to keep SCSI initiator and SCSI target headers 
separate I think we will need two logical_to_sectors() functions - one 
for SCSI initiator devices and one for SCSI target devices.

Bart.

WARNING: multiple messages have this Message-ID (diff)
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: <mchristi@redhat.com>, <linux-scsi@vger.kernel.org>,
	<target-devel@vger.kernel.org>, <socketpair@gmail.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH 2/2] target: fix max discard sectors calculation
Date: Tue, 17 May 2016 11:16:38 -0700	[thread overview]
Message-ID: <573B6006.8010206@sandisk.com> (raw)
In-Reply-To: <yq1y479hlmp.fsf@sermon.lab.mkp.net>

On 05/16/2016 12:02 PM, Martin K. Petersen wrote:
>>>>>> "Bart" == Bart Van Assche <bart.vanassche@sandisk.com> writes:
>
> Bart> That's a good catch. But seeing this patch makes me wonder whether
> Bart> this patch introduces a 64-bit division? If so, I'm afraid this
> Bart> patch will make 32-bit users unhappy. Have you considered to use
> Bart> do_div() or >> (ilog2(block_size) - 9) instead? For the latter
> Bart> alternative no 64-bit cast is needed.
>
> Please use logical_to_sectors().

Hello Martin,

For SCSI initiator devices the logical block size is stored in struct 
scsi_device. logical_to_sectors() gets the logical block size from 
struct scsi_device. LIO however stores the logical block size in struct 
se_dev_attrib. If we want to keep SCSI initiator and SCSI target headers 
separate I think we will need two logical_to_sectors() functions - one 
for SCSI initiator devices and one for SCSI target devices.

Bart.

  reply	other threads:[~2016-05-17 18:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 18:46 [PATCH 0/2] fix max discard sectors calculation mchristi
2016-05-16 18:46 ` [PATCH 1/2] scsi: " mchristi
2016-05-16 22:44   ` Bart Van Assche
2016-05-16 22:44     ` Bart Van Assche
2016-05-17  3:46     ` Mike Christie
2016-05-16 18:46 ` [PATCH 2/2] target: " mchristi
2016-05-16 18:57   ` Bart Van Assche
2016-05-16 18:57     ` Bart Van Assche
2016-05-16 19:00     ` Mike Christie
2016-05-16 19:02     ` Martin K. Petersen
2016-05-16 19:02       ` Martin K. Petersen
2016-05-17 18:16       ` Bart Van Assche [this message]
2016-05-17 18:16         ` Bart Van Assche
2016-05-17 21:49         ` Mike Christie
2016-05-18 16:56           ` Bart Van Assche
2016-05-18 16:56             ` Bart Van Assche
2016-05-18 17:17             ` Mike Christie

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=573B6006.8010206@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mchristi@redhat.com \
    --cc=socketpair@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.