lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 19 Nov 2007 16:14:52 +0100
From:	Jan Kara <jack@...e.cz>
To:	Wang Yu <wangyuict@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: about ext3_readpage

  Hi,

> when I read ext3_readpage function following
> ext3_readpage->mpage_readpage->do_mpage_readpage, there are:
> 
> nblocks = map_bh->b_size >> blkbits;
>         if (buffer_mapped(map_bh) && block_in_file > *first_logical_block &&
>                         block_in_file < (*first_logical_block + nblocks)) {
>                 unsigned map_offset = block_in_file - *first_logical_block;
>                 unsigned last = nblocks - map_offset;
> 
>                 for (relative_block = 0; ; relative_block++) {
>                         if (relative_block == last) {
>                                 clear_buffer_mapped(map_bh);
>                                 break;
>                         }
>                         if (page_block == blocks_per_page)
>                                 break;
>                         blocks[page_block] = map_bh->b_blocknr + map_offset +
>                                                 relative_block;
>                         page_block++;
>                         block_in_file++;
>                 }
>                 bdev = map_bh->b_bdev;
>         }
> 
> Since map_bh->b_size is the size of the block buffer, and blkbits is
> associated with the block in inode, why does he do the operation >> ?
> And what is the meaning and usage of  first_logical_block? the initial
> value of it is 0.
  Hmm, the code is quite "inventive" in the way it uses struct
buffer_head - does anybody know if we have this documented anywhere BTW?
  In b_size it keeps the size of area it would like to map, filesystem
on the other hand returns in it how much it managed to map from the
required area. This number is in bytes, thus it has to be divided by the
size of the block ( >>blkbits is just a more effective way to code
division). Variable first_logical_block keeps offset (in blocks) at
which the last call to get_block() happened.

								Honza
-- 
Jan Kara <jack@...e.cz>
SuSE CR Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ