lkml.org 
[lkml]   [2014]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] drivers: target: target_core_mod: use div64_u64_rem() instead of operator '%' for u64
From
Date
On Thu, 2014-01-09 at 11:17 +0100, Hannes Reinecke wrote:
> On 01/09/2014 12:18 AM, Nicholas A. Bellinger wrote:
> > On Wed, 2014-01-08 at 08:32 +0100, Hannes Reinecke wrote:

<SNIP>

> >> Other than that the sector_div() patch is correct.
> >>
> >
> > <nod> Thanks for confirming that sector_div() is correct here vs. the
> > original code using modulo that Chen had pointed out.
> >
> Ah, _that_ was the issue.
> I was wondering why you kept on poking me ...
>
> Well.
> No, that's actually _not_ correct.
> The correct fix would be
>
> diff --git a/drivers/target/target_core_alua.c
> b/drivers/target/target_core_alua.c
> index 54b1e52..12da9b3 100644
> --- a/drivers/target/target_core_alua.c
> +++ b/drivers/target/target_core_alua.c
> @@ -500,8 +500,7 @@ static inline int core_alua_state_lba_dependent(
>
> if (segment_mult) {
> u64 tmp = lba;
> - sector_div(tmp, segment_size * segment_mult);
> - start_lba = tmp;
> + start_lba = sector_div(tmp, segment_size * segment_mult);
>
> last_lba = first_lba + segment_size - 1;
> if (start_lba >= first_lba &&
> (beware of line breaks ...)
> Thing is, we need to calculate the offset into the segment to figure out
> which map entry to use.
> The actual number of the segment (as had been calculated with the
> original fix) is immaterial here.
>
> Sorry for this. The email thread just flew past me during Xmas
> with me not paying real attention.
>

Applied + squashed. Apologies for the initial pre-holiday BUG..

Thanks Hannes!

--nab



\
 
 \ /
  Last update: 2014-01-10 07:01    [W:0.071 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site