Example #1
0
static int ext2_block_to_path(struct inode *inode,
                              long i_block, int offsets[4], int *boundary)
{
    int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);
    int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);
    const long direct_blocks = EXT2_NDIR_BLOCKS,
               indirect_blocks = ptrs,
               double_blocks = (1 << (ptrs_bits * 2));
    int n = 0;
    int final = 0;

    if (i_block < 0) {
        ext2_warning (inode->i_sb, "ext2_block_to_path", "block < 0");
    } else if (i_block < direct_blocks) {
        offsets[n++] = i_block;
        final = direct_blocks;
Example #2
0
static int ext2_block_to_path(struct inode *inode,
			      long i_block, int offsets[4], int *boundary)
{
        int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);             /* max no.of logic block pointers in a block, say 1024 for 4k block */
        int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);   /* no.of bit for above, say 10 */
        const long direct_blocks = EXT2_NDIR_BLOCKS,		 /*say 12*/
          indirect_blocks = ptrs,				 /*say 1024*/
          double_blocks = (1 << (ptrs_bits * 2));		 /*say 1024 * 1024*/
        int n = 0;
        int final = 0;

	if (i_block < 0) {
		ext2_warning (inode->i_sb, "ext2_block_to_path", "block < 0");
	} else if (i_block < direct_blocks) {
		offsets[n++] = i_block;
		final = direct_blocks;
Example #3
0
static int ext2_block_to_path(struct inode *inode, long i_block, int offsets[4])
{
	int ptrs = EXT2_ADDR_PER_BLOCK(inode->i_sb);
	int ptrs_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb);
	const long direct_blocks = EXT2_NDIR_BLOCKS,
		indirect_blocks = ptrs,
		double_blocks = (1 << (ptrs_bits * 2));
	int n = 0;

	if (i_block < 0) {
		ext2_warning (inode->i_sb, "ext2_block_to_path", "block < 0");
	} else if (i_block < direct_blocks) {
		offsets[n++] = i_block;
	} else if ( (i_block -= direct_blocks) < indirect_blocks) {
		offsets[n++] = EXT2_IND_BLOCK;
		offsets[n++] = i_block;
	} else if ((i_block -= indirect_blocks) < double_blocks) {
		offsets[n++] = EXT2_DIND_BLOCK;
		offsets[n++] = i_block >> ptrs_bits;
		offsets[n++] = i_block & (ptrs - 1);
	} else if (((i_block -= double_blocks) >> (ptrs_bits * 2)) < ptrs) {