Re: [PATCH 2/2] target: fix max discard sectors calculation

2016-05-18 Thread Mike Christie
On 05/18/2016 11:56 AM, Bart Van Assche wrote: > On 05/17/2016 02:49 PM, Mike Christie wrote: >> --- a/drivers/target/target_core_device.c >> +++ b/drivers/target/target_core_device.c >> @@ -821,13 +821,15 @@ struct se_device *target_alloc_device(struct >> se_hba *hba, const char *name) >>* in

Re: [PATCH 2/2] target: fix max discard sectors calculation

2016-05-18 Thread Bart Van Assche
On 05/17/2016 02:49 PM, Mike Christie wrote: --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -821,13 +821,15 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) * in ATA and we need to set TPE=1 */ bool target_configure_un

Re: [PATCH 2/2] target: fix max discard sectors calculation

2016-05-17 Thread Mike Christie
On 05/17/2016 01:16 PM, Bart Van Assche wrote: > On 05/16/2016 12:02 PM, Martin K. Petersen wrote: >>> "Bart" == Bart Van Assche 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 >> Ba

Re: [PATCH 2/2] target: fix max discard sectors calculation

2016-05-17 Thread Bart Van Assche
On 05/16/2016 12:02 PM, Martin K. Petersen wrote: "Bart" == Bart Van Assche 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

Re: [PATCH 2/2] target: fix max discard sectors calculation

2016-05-16 Thread Martin K. Petersen
> "Bart" == Bart Van Assche 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

Re: [PATCH 2/2] target: fix max discard sectors calculation

2016-05-16 Thread Mike Christie
On 05/16/2016 01:57 PM, Bart Van Assche wrote: > On 05/16/2016 11:46 AM, mchri...@redhat.com wrote: >> diff --git a/drivers/target/target_core_device.c >> b/drivers/target/target_core_device.c >> index a4046ca..3f9f304 100644 >> --- a/drivers/target/target_core_device.c >> +++ b/drivers/target/targ

Re: [PATCH 2/2] target: fix max discard sectors calculation

2016-05-16 Thread Bart Van Assche
On 05/16/2016 11:46 AM, mchri...@redhat.com wrote: diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index a4046ca..3f9f304 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -826,8 +826,8 @@ bool target_configure_un

[PATCH 2/2] target: fix max discard sectors calculation

2016-05-16 Thread mchristi
From: Mike Christie max_discard_sectors and block_size are 32 bits, so we can overflow when trying to convert between the linux block layer max discard sectors and the LIO value. This fixes a regression caused by this patch: commit 8a9ebe717a133ba7bc90b06047f43cc6b8bcb8b3 Author: Mike Christie