Commit 363041a5 authored by Mark Fasheh's avatar Mark Fasheh

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: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent dcd0538f
...@@ -1146,9 +1146,8 @@ static void find_leaf_ins(void *data, struct buffer_head *bh) ...@@ -1146,9 +1146,8 @@ static void find_leaf_ins(void *data, struct buffer_head *bh)
* *
* This function doesn't handle non btree extent lists. * This function doesn't handle non btree extent lists.
*/ */
static int ocfs2_find_leaf(struct inode *inode, int ocfs2_find_leaf(struct inode *inode, struct ocfs2_extent_list *root_el,
struct ocfs2_extent_list *root_el, u32 cpos, u32 cpos, struct buffer_head **leaf_bh)
struct buffer_head **leaf_bh)
{ {
int ret; int ret;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
......
...@@ -80,4 +80,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, ...@@ -80,4 +80,7 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
struct ocfs2_truncate_context *tc); 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 */ #endif /* OCFS2_ALLOC_H */
...@@ -158,8 +158,7 @@ static int ocfs2_get_block(struct inode *inode, sector_t iblock, ...@@ -158,8 +158,7 @@ static int ocfs2_get_block(struct inode *inode, sector_t iblock,
if (err) if (err)
goto bail; goto bail;
err = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno, err = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno, NULL);
NULL);
if (err) { if (err) {
mlog(ML_ERROR, "Error %d from get_blocks(0x%p, %llu, 1, " mlog(ML_ERROR, "Error %d from get_blocks(0x%p, %llu, 1, "
"%llu, NULL)\n", err, inode, (unsigned long long)iblock, "%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) ...@@ -499,8 +498,7 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
down_read(&OCFS2_I(inode)->ip_alloc_sem); down_read(&OCFS2_I(inode)->ip_alloc_sem);
} }
err = ocfs2_extent_map_get_blocks(inode, block, 1, &p_blkno, err = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL);
NULL);
if (!INODE_JOURNAL(inode)) { if (!INODE_JOURNAL(inode)) {
up_read(&OCFS2_I(inode)->ip_alloc_sem); 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, ...@@ -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 /* This figures out the size of the next contiguous block, and
* our logical offset */ * 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); &contig_blocks);
if (ret) { if (ret) {
mlog(ML_ERROR, "get_blocks() failed iblock=%llu\n", mlog(ML_ERROR, "get_blocks() failed iblock=%llu\n",
......
...@@ -379,7 +379,7 @@ int ocfs2_do_extend_dir(struct super_block *sb, ...@@ -379,7 +379,7 @@ int ocfs2_do_extend_dir(struct super_block *sb,
status = ocfs2_extent_map_get_blocks(dir, (dir->i_blocks >> status = ocfs2_extent_map_get_blocks(dir, (dir->i_blocks >>
(sb->s_blocksize_bits - 9)), (sb->s_blocksize_bits - 9)),
1, &p_blkno, NULL); &p_blkno, NULL);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
......
...@@ -1614,10 +1614,6 @@ static int ocfs2_meta_lock_update(struct inode *inode, ...@@ -1614,10 +1614,6 @@ static int ocfs2_meta_lock_update(struct inode *inode,
* for the inode metadata. */ * for the inode metadata. */
ocfs2_metadata_cache_purge(inode); 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)) { if (ocfs2_meta_lvb_is_trustable(inode, lockres)) {
mlog(0, "Trusting LVB on inode %llu\n", mlog(0, "Trusting LVB on inode %llu\n",
(unsigned long long)oi->ip_blkno); (unsigned long long)oi->ip_blkno);
......
This diff is collapsed.
...@@ -25,22 +25,7 @@ ...@@ -25,22 +25,7 @@
#ifndef _EXTENT_MAP_H #ifndef _EXTENT_MAP_H
#define _EXTENT_MAP_H #define _EXTENT_MAP_H
int init_ocfs2_extent_maps(void); int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
void exit_ocfs2_extent_maps(void); int *ret_count);
/*
* 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);
#endif /* _EXTENT_MAP_H */ #endif /* _EXTENT_MAP_H */
...@@ -1003,9 +1003,6 @@ void ocfs2_clear_inode(struct inode *inode) ...@@ -1003,9 +1003,6 @@ void ocfs2_clear_inode(struct inode *inode)
"Clear inode of %llu, inode has io markers\n", "Clear inode of %llu, inode has io markers\n",
(unsigned long long)oi->ip_blkno); (unsigned long long)oi->ip_blkno);
ocfs2_extent_map_drop(inode, 0);
ocfs2_extent_map_init(inode);
status = ocfs2_drop_inode_locks(inode); status = ocfs2_drop_inode_locks(inode);
if (status < 0) if (status < 0)
mlog_errno(status); mlog_errno(status);
...@@ -1102,8 +1099,7 @@ struct buffer_head *ocfs2_bread(struct inode *inode, ...@@ -1102,8 +1099,7 @@ struct buffer_head *ocfs2_bread(struct inode *inode,
return NULL; return NULL;
} }
tmperr = ocfs2_extent_map_get_blocks(inode, block, 1, tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL);
&p_blkno, NULL);
if (tmperr < 0) { if (tmperr < 0) {
mlog_errno(tmperr); mlog_errno(tmperr);
goto fail; goto fail;
......
...@@ -43,7 +43,6 @@ struct ocfs2_inode_info ...@@ -43,7 +43,6 @@ struct ocfs2_inode_info
spinlock_t ip_lock; spinlock_t ip_lock;
u32 ip_open_count; u32 ip_open_count;
u32 ip_clusters; u32 ip_clusters;
struct ocfs2_extent_map ip_map;
struct list_head ip_io_markers; struct list_head ip_io_markers;
struct mutex ip_io_mutex; struct mutex ip_io_mutex;
......
...@@ -670,8 +670,7 @@ static int ocfs2_force_read_journal(struct inode *inode) ...@@ -670,8 +670,7 @@ static int ocfs2_force_read_journal(struct inode *inode)
(inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9))) { (inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9))) {
status = ocfs2_extent_map_get_blocks(inode, v_blkno, status = ocfs2_extent_map_get_blocks(inode, v_blkno,
1, &p_blkno, &p_blkno, &p_blocks);
&p_blocks);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
......
...@@ -1511,8 +1511,7 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb, ...@@ -1511,8 +1511,7 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb,
goto bail; goto bail;
} }
status = ocfs2_extent_map_get_blocks(inode, 0, 1, &p_blkno, status = ocfs2_extent_map_get_blocks(inode, 0, &p_blkno, &p_blocks);
&p_blocks);
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
......
...@@ -46,11 +46,6 @@ ...@@ -46,11 +46,6 @@
#include "endian.h" #include "endian.h"
#include "ocfs2_lockid.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 /* Most user visible OCFS2 inodes will have very few pieces of
* metadata, but larger files (including bitmaps, etc) must be taken * metadata, but larger files (including bitmaps, etc) must be taken
* into account when designing an access scheme. We allow a small * into account when designing an access scheme. We allow a small
......
...@@ -197,7 +197,7 @@ int ocfs2_init_slot_info(struct ocfs2_super *osb) ...@@ -197,7 +197,7 @@ int ocfs2_init_slot_info(struct ocfs2_super *osb)
goto bail; 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) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
goto bail; goto bail;
......
...@@ -806,9 +806,6 @@ static int __init ocfs2_init(void) ...@@ -806,9 +806,6 @@ static int __init ocfs2_init(void)
ocfs2_print_version(); ocfs2_print_version();
if (init_ocfs2_extent_maps())
return -ENOMEM;
status = init_ocfs2_uptodate_cache(); status = init_ocfs2_uptodate_cache();
if (status < 0) { if (status < 0) {
mlog_errno(status); mlog_errno(status);
...@@ -837,7 +834,6 @@ static int __init ocfs2_init(void) ...@@ -837,7 +834,6 @@ static int __init ocfs2_init(void)
if (status < 0) { if (status < 0) {
ocfs2_free_mem_caches(); ocfs2_free_mem_caches();
exit_ocfs2_uptodate_cache(); exit_ocfs2_uptodate_cache();
exit_ocfs2_extent_maps();
} }
mlog_exit(status); mlog_exit(status);
...@@ -863,8 +859,6 @@ static void __exit ocfs2_exit(void) ...@@ -863,8 +859,6 @@ static void __exit ocfs2_exit(void)
unregister_filesystem(&ocfs2_fs_type); unregister_filesystem(&ocfs2_fs_type);
exit_ocfs2_extent_maps();
exit_ocfs2_uptodate_cache(); exit_ocfs2_uptodate_cache();
mlog_exit_void(); mlog_exit_void();
...@@ -948,7 +942,6 @@ static void ocfs2_inode_init_once(void *data, ...@@ -948,7 +942,6 @@ static void ocfs2_inode_init_once(void *data,
oi->ip_flags = 0; oi->ip_flags = 0;
oi->ip_open_count = 0; oi->ip_open_count = 0;
spin_lock_init(&oi->ip_lock); spin_lock_init(&oi->ip_lock);
ocfs2_extent_map_init(&oi->vfs_inode);
INIT_LIST_HEAD(&oi->ip_io_markers); INIT_LIST_HEAD(&oi->ip_io_markers);
oi->ip_created_trans = 0; oi->ip_created_trans = 0;
oi->ip_last_trans = 0; oi->ip_last_trans = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment