Re: [PATCH 1/2] target/rd: simplify the page/offset computation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 26 November 2011 14:02:39 +0100, Sebastian Andrzej Siewior wrote:
> On 11/25/2011 11:05 PM, Jörn Engel wrote:
>>> +	tmp = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size;
>>> +	req->rd_offset = do_div(tmp, PAGE_SIZE);
>>> +	req->rd_page = tmp;
>>
>> How about:
>> 	byte_offset = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size;
>> 	req->rd_offset = byte_offset&  ~PAGE_MASK;
>> 	req->rd_page = byte_offset>>  PAGE_SHIFT;
>>
>
> I could change tmp to byte_offset if you want. However your & probably
> does not compile on 32bit. And for that reason we have do_div() :)

Are you saying that you cannot mask 64bit value on 32bit machines?  Or
shift?  Even if that were true, which I doubt very much, the answer
would be to create something like do_div() for masks and shifts, and
explicitly not use 64bit divisions on a 32bit cpu.

Also please notice the missing ">> PAGE_SHIFT" when assigning
req->rd_page in your patch.

Jörn

-- 
What one programmer can do in one month, two programmers can do in two months.
-- Fred Brooks
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux