ocfs2: temporarily remove extent map caching

The code in extent_map.c is not prepared to deal with a subtree being
rotated between lookups. This can happen when filling holes in sparse files.
Instead of a lengthy patch to update the code (which would likely lose the
benefit of caching subtree roots), we remove most of the algorithms and
implement a simple path based lookup. A less ambitious extent caching scheme
will be added in a later patch.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
This commit is contained in:
Mark Fasheh 2007-01-17 12:31:35 -08:00
parent dcd0538ff4
commit 363041a5f7
14 changed files with 110 additions and 1010 deletions

View File

@ -1146,9 +1146,8 @@ static void find_leaf_ins(void *data, struct buffer_head *bh)
*
* This function doesn't handle non btree extent lists.
*/
static int ocfs2_find_leaf(struct inode *inode,
struct ocfs2_extent_list *root_el, u32 cpos,
struct buffer_head **leaf_bh)
int ocfs2_find_leaf(struct inode *inode, struct ocfs2_extent_list *root_el,
u32 cpos, struct buffer_head **leaf_bh)
{
int ret;
struct buffer_head *bh = NULL;

View File

@ -80,4 +80,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
struct buffer_head *fe_bh,
struct ocfs2_truncate_context *tc);
int ocfs2_find_leaf(struct inode *inode, struct ocfs2_extent_list *root_el,
u32 cpos, struct buffer_head **leaf_bh);
#endif /* OCFS2_ALLOC_H */

View File

@ -158,8 +158,7 @@ static int ocfs2_get_block(struct inode *inode, sector_t iblock,
if (err)
goto bail;
err = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno,
NULL);
err = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno, NULL);
if (err) {
mlog(ML_ERROR, "Error %d from get_blocks(0x%p, %llu, 1, "
"%llu, NULL)\n", err, inode, (unsigned long long)iblock,
@ -499,8 +498,7 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
down_read(&OCFS2_I(inode)->ip_alloc_sem);
}
err = ocfs2_extent_map_get_blocks(inode, block, 1, &p_blkno,
NULL);
err = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL);
if (!INODE_JOURNAL(inode)) {
up_read(&OCFS2_I(inode)->ip_alloc_sem);
@ -574,7 +572,7 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
/* This figures out the size of the next contiguous block, and
* our logical offset */
ret = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno,
ret = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno,
&contig_blocks);
if (ret) {
mlog(ML_ERROR, "get_blocks() failed iblock=%llu\n",

View File

@ -379,7 +379,7 @@ int ocfs2_do_extend_dir(struct super_block *sb,
status = ocfs2_extent_map_get_blocks(dir, (dir->i_blocks >>
(sb->s_blocksize_bits - 9)),
1, &p_blkno, NULL);
&p_blkno, NULL);
if (status < 0) {
mlog_errno(status);
goto bail;

View File

@ -1614,10 +1614,6 @@ static int ocfs2_meta_lock_update(struct inode *inode,
* for the inode metadata. */
ocfs2_metadata_cache_purge(inode);
/* will do nothing for inode types that don't use the extent
* map (bitmap files, etc) */
ocfs2_extent_map_trunc(inode, 0);
if (ocfs2_meta_lvb_is_trustable(inode, lockres)) {
mlog(0, "Trusting LVB on inode %llu\n",
(unsigned long long)oi->ip_blkno);

File diff suppressed because it is too large Load Diff

View File

@ -25,22 +25,7 @@
#ifndef _EXTENT_MAP_H
#define _EXTENT_MAP_H
int init_ocfs2_extent_maps(void);
void exit_ocfs2_extent_maps(void);
/*
* EVERY CALL here except _init, _trunc, and _drop expects alloc_sem
* to be held. The allocation cannot change at all while the map is
* in the process of being updated.
*/
int ocfs2_extent_map_init(struct inode *inode);
int ocfs2_extent_map_append(struct inode *inode,
struct ocfs2_extent_rec *rec,
u32 new_clusters);
int ocfs2_extent_map_get_blocks(struct inode *inode,
u64 v_blkno, int count,
u64 *p_blkno, int *ret_count);
int ocfs2_extent_map_drop(struct inode *inode, u32 new_clusters);
int ocfs2_extent_map_trunc(struct inode *inode, u32 new_clusters);
int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
int *ret_count);
#endif /* _EXTENT_MAP_H */

View File

@ -1003,9 +1003,6 @@ void ocfs2_clear_inode(struct inode *inode)
"Clear inode of %llu, inode has io markers\n",
(unsigned long long)oi->ip_blkno);
ocfs2_extent_map_drop(inode, 0);
ocfs2_extent_map_init(inode);
status = ocfs2_drop_inode_locks(inode);
if (status < 0)
mlog_errno(status);
@ -1102,8 +1099,7 @@ struct buffer_head *ocfs2_bread(struct inode *inode,
return NULL;
}
tmperr = ocfs2_extent_map_get_blocks(inode, block, 1,
&p_blkno, NULL);
tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL);
if (tmperr < 0) {
mlog_errno(tmperr);
goto fail;

View File

@ -43,7 +43,6 @@ struct ocfs2_inode_info
spinlock_t ip_lock;
u32 ip_open_count;
u32 ip_clusters;
struct ocfs2_extent_map ip_map;
struct list_head ip_io_markers;
struct mutex ip_io_mutex;

View File

@ -670,8 +670,7 @@ static int ocfs2_force_read_journal(struct inode *inode)
(inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9))) {
status = ocfs2_extent_map_get_blocks(inode, v_blkno,
1, &p_blkno,
&p_blocks);
&p_blkno, &p_blocks);
if (status < 0) {
mlog_errno(status);
goto bail;

View File

@ -1511,8 +1511,7 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb,
goto bail;
}
status = ocfs2_extent_map_get_blocks(inode, 0, 1, &p_blkno,
&p_blocks);
status = ocfs2_extent_map_get_blocks(inode, 0, &p_blkno, &p_blocks);
if (status < 0) {
mlog_errno(status);
goto bail;

View File

@ -46,11 +46,6 @@
#include "endian.h"
#include "ocfs2_lockid.h"
struct ocfs2_extent_map {
u32 em_clusters;
struct rb_root em_extents;
};
/* Most user visible OCFS2 inodes will have very few pieces of
* metadata, but larger files (including bitmaps, etc) must be taken
* into account when designing an access scheme. We allow a small

View File

@ -197,7 +197,7 @@ int ocfs2_init_slot_info(struct ocfs2_super *osb)
goto bail;
}
status = ocfs2_extent_map_get_blocks(inode, 0ULL, 1, &blkno, NULL);
status = ocfs2_extent_map_get_blocks(inode, 0ULL, &blkno, NULL);
if (status < 0) {
mlog_errno(status);
goto bail;

View File

@ -806,9 +806,6 @@ static int __init ocfs2_init(void)
ocfs2_print_version();
if (init_ocfs2_extent_maps())
return -ENOMEM;
status = init_ocfs2_uptodate_cache();
if (status < 0) {
mlog_errno(status);
@ -837,7 +834,6 @@ leave:
if (status < 0) {
ocfs2_free_mem_caches();
exit_ocfs2_uptodate_cache();
exit_ocfs2_extent_maps();
}
mlog_exit(status);
@ -863,8 +859,6 @@ static void __exit ocfs2_exit(void)
unregister_filesystem(&ocfs2_fs_type);
exit_ocfs2_extent_maps();
exit_ocfs2_uptodate_cache();
mlog_exit_void();
@ -948,7 +942,6 @@ static void ocfs2_inode_init_once(void *data,
oi->ip_flags = 0;
oi->ip_open_count = 0;
spin_lock_init(&oi->ip_lock);
ocfs2_extent_map_init(&oi->vfs_inode);
INIT_LIST_HEAD(&oi->ip_io_markers);
oi->ip_created_trans = 0;
oi->ip_last_trans = 0;