Re: [RFC PATCH 3/3] ext4: cache all of an extent tree's leaf block upon reading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> @@ -490,6 +491,31 @@ __read_extent_tree_block(const char *function, unsigned int line,
>  	if (err)
>  		goto errout;
>  	set_buffer_verified(bh);
> +	/*
> +	 * If this is a leaf block, cache all of its entries
> +	 */
> +	if (!(flags & EXT4_EX_NOCACHE) && depth == 0) {
> +		struct ext4_extent_header *eh = ext_block_hdr(bh);
> +		struct ext4_extent *ex = EXT_FIRST_EXTENT(eh);
> +		int i;
> +
> +		for (i = eh->eh_entries; i > 0; i--, ex++) {
> +			unsigned int status = EXTENT_STATUS_WRITTEN;
> +			ext4_lblk_t prev = 0, lblk = le32_to_cpu(ex->ee_block);
> +			int len = ext4_ext_get_actual_len(ex);
> +
> +			if (prev && (prev != lblk))
> +				ext4_es_cache_extent(inode, prev,
> +						     lblk - prev, ~0,
> +						     EXTENT_STATUS_HOLE);
> +
> +			if (ext4_ext_is_uninitialized(ex))
> +				status = EXTENT_STATUS_UNWRITTEN;
> +			ext4_es_cache_extent(inode, lblk, len,
> +					     ext4_ext_pblock(ex), status);
> +			prev = lblk + len;
> +		}
> +	}

Isn't prev going to be reinitialized to 0 for every extent?

- z
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux