[Ocfs2-tools-devel] [PATCH 11/11] fsck.ocfs2: Add readahead in Pass 2

Sunil Mushran sunil.mushran at oracle.com
Fri Sep 23 10:46:02 PDT 2011


On 09/23/2011 09:49 AM, Goldwyn Rodrigues wrote:
> On Thu, Sep 22, 2011 at 9:04 PM, Sunil Mushran<sunil.mushran at oracle.com>  wrote:
>> This patch adds code to readahead directory blocks in pass 2. It reads upto
>> 1024 blocks. Those blocks are then verified after which the utility reads
>> another 1024 blocks. And so on. This scheme prevents blowing up the cache.
>>
>> What this does not as yet is pre-read the directory index blocks and the
>> inodes specified in the directory block. That is left for a later exercise.
>>
>> The test was run on a 2TB volume having 15M files. The cache size was 820MB.
>>
>> Pass 2: Checking directory entries
>>
>> Before:
>>   I/O read disk/cache: 3897MB / 131MB, write: 0MB, rate: 2.84MB/s
>>   Times real: 1416.929s, user: 124.587s, sys: 17.412s
>>
>> After:
>>   I/O read disk/cache: 3902MB / 3937MB, write: 0MB, rate: 25.82MB/s
>>   Times real: 303.600s, user: 95.781s, sys: 13.443s
>>
>> Signed-off-by: Sunil Mushran<sunil.mushran at oracle.com>
<snip>
>> @@ -143,16 +188,22 @@ void o2fsck_dir_block_iterate(o2fsck_state *ost, dirblock_iterator func,
>>   {
>>         o2fsck_dirblocks *db =&ost->ost_dirblocks;
>>         o2fsck_dirblock_entry *dbe;
>> -       struct rb_node *node;
>> +       struct rb_node *node, *last_read_node = NULL;
>>         unsigned ret;
>> +       int readahead = 1;
>>
>>         for (node = rb_first(&db->db_root); node; node = rb_next(node)) {
>>                 dbe = rb_entry(node, o2fsck_dirblock_entry, e_node);
>> +               if (readahead)
>> +                       o2fsck_readahead_dirblocks(ost, node,&last_read_node);
>> +               readahead = 0;
>>                 ret = func(dbe, priv_data);
>>                 if (ret&  OCFS2_DIRENT_ABORT)
>>                         break;
>>                 if (ost->ost_prog)
>>                         tools_progress_step(ost->ost_prog, 1);
>> +               if (last_read_node == node)
>> +                       readahead = 1;
> You can do away with readahead variable if you move this condition
> when calling o2fsck_readahead_dirblocks()

Yes.... but the reads will overlap by a block. First round 1 - 10, next 10 - 19,
instead of 11 - 20.



More information about the Ocfs2-tools-devel mailing list