Linux RAID subsystem development
 help / color / mirror / Atom feed
From: SandeepKsinha <sandeepksinha@gmail.com>
To: NeilBrown <neilb@suse.de>
Cc: Linux RAID <linux-raid@vger.kernel.org>
Subject: Re: [PATCH] md: Enhancements and clean to linear RAID
Date: Tue, 19 May 2009 16:16:01 +0530	[thread overview]
Message-ID: <37d33d830905190346g4147a114o5f4a53bf64c1ebac@mail.gmail.com> (raw)
In-Reply-To: <37d33d830905190031u5172af46kccb720343e359d99@mail.gmail.com>

Hi Neil,

I have made all the required changes and have tested the changes.
It works fine.

Thanks for enlightening me, the changes really optimized the code further.

The patches will be followed by this mail.

On Tue, May 19, 2009 at 1:01 PM, SandeepKsinha <sandeepksinha@gmail.com> wrote:
> Thanks Neil,
>
>
> On Tue, May 19, 2009 at 12:55 PM, NeilBrown <neilb@suse.de> wrote:
>> On Tue, May 19, 2009 4:23 pm, SandeepKsinha wrote:
>>> Hi Neil,
>>>
>>> I have made the desired changes and have tested the changes as well.
>>> As expected the performance gain with number of devices ( > 20 ) is
>>> quite visible.
>>
>> How did you measure the performance gain and what were your
>> results?
>>
>
> I created arrays with 20 devices and performed random I/O it.
> The results with linear search were slower as compared to binary.
>
>>> The code also looks simpler as compared to what it earlier was.
>>>
>>> I have created the following patches for the changes:
>>>
>>> PATCH [01/03] md: Removal of num_sectors from dev_info in linear raid
>>>
>>> This patch removes the num_sectors from dev_info and makes use of the
>>> rdev->sectors for
>>> all further usage.
>>
>> Could I as you to redo this one a little differently?
>> I want to keep the linear search very tight, and you have just added
>> a pointer de-reference to it.
>>
>> If you could replace start_sector by end_sector, we wouldn't need that
>> de-reference or the addition.
>>
>>
> I would make the required changes.
>
>>>
>>> PATCH[02/03] md: Getting rid of sector_div and hash table in linear raid
>>>
>>> Removal of all the code pertaining hast table and other related data
>>> structures.
>>> This also makes the code really really simple.
>>> The searching being made linear for the time being to test the patch.
>>>
>>> PATCH[03/03] md: Replacing linear with a binary search
>>>
>>> This patch replaces the linear search in which_dev with binary search.
>>
>> Two things wrong with you binary search.
>> 1/ the while() condition is "hi >= lo".  That will always be true, so it
>>  would be better to make that explicit.  i.e. "while(1)".
>>  However the while loop of a binary search should be
>>   while (hi > lo)
>>
>> 2/ You have 3 comparisons against 'sector' inside the loop.  There should
>>   only be one.  We are aiming for speed remember :-)
>>
>>   while (hi > lo) {
>>       mid = (hi + lo + 1) / 2;
>>       dev = conf->disks + mid;
>>
>>       if (sector >= dev->start_sector)
>>            lo = mid;
>>       else
>>            hi = mid - 1;
>>    }
>>    return dev;
>>
>>    With that formulation, you don't even need to replace
>>    sector_start by sector_end.. However doing so would make other
>>    code simpler, so please do proceed with replacing sector_start by
>>    sector_end.
>>    Then the binary search (with a fix because dev can be uninitialised),
>>    becomes:
>>
>>    while (hi > lo) {
>>       mid = (hi + lo) / 2;
>>
>>       if (sector < conf->disks[mid].end_sector)
>>            hi = mid;
>>       else
>>            lo = mid + 1;
>>    }
>>    return conf->disks + lo;
>>
>
> I will make this change too.
>
>
> Thanks.
>
>> NeilBrown
>>
>>
>>
>>
>
>
>
> --
> Regards,
> Sandeep.
>
>
>
>
>
>
> “To learn is to change. Education is a process that changes the learner.”
>



-- 
Regards,
Sandeep.





 	
“To learn is to change. Education is a process that changes the learner.”
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-05-19 10:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19  6:23 [PATCH] md: Enhancements and clean to linear RAID SandeepKsinha
2009-05-19  7:25 ` NeilBrown
2009-05-19  7:31   ` SandeepKsinha
2009-05-19 10:46     ` SandeepKsinha [this message]
2009-05-19 11:38       ` Neil Brown
2009-05-19 11:56         ` SandeepKsinha
2009-05-19 12:32           ` Sujit Karataparambil
2009-05-21  3:15         ` SandeepKsinha
2009-05-21  3:47           ` NeilBrown

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=37d33d830905190346g4147a114o5f4a53bf64c1ebac@mail.gmail.com \
    --to=sandeepksinha@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox