Skip to contentSkip to conversation

Regarding RAID0 Code

DISCUSSION Neil Brown 1 participant 1 message Jan 3, 2005 1 message not in the archive MD RAID

lore
Share & tools
lore

Neil Brown

author
#1 lore raw
In reply to a message not in the archive
Quoted 11 lines · On Saturday January 1, [email protected] wrote:

Respected Sir,

I am a student from India. I am studying the RAID 0 code in the linux kernel 2.4.20. I got some problems in understanding the code, especially in the raid0_make_request function. I didnt understand the following statements.. like why the anding is done, and what is sect_in_chunk. Please if you could tell me the details, it would be a very great help for me. Please sir, hoping for some help.

Quoted 5 lines
258         sect_in_chunk = bh->b_rsector & ((chunk_size<<1) -1);
259         chunk = (block - zone->zone_offset) / (zone->nb_dev << chunksize_bits);
260         tmp_dev = zone->dev[(block >> chunksize_bits) % zone->nb_dev];
261         rsect = (((chunk << chunksize_bits) + zone->dev_offset)<<1)

262 + sect_in_chunk;

"sect_in_chunk" is the number of the target sector within it's chunk. i.e. the remainder when the target sector is divided by the chunk size.

If it still doesn't make sense, try writing the code for mapping an array sector number to a (device number + device sector number). Then ask specifically about differences.

NeilBrown

Quoted 8 lines

Thanking you in anticipation.

With Regards,
Poonam Dalya,
PICT,Pune,
INDIA.