ocfs2: Detach ocfs2 metadata I/O from struct inode
cover ocfs2: Detach ocfs2 metadata I/O from struct inode
The following series of patches attempts to detach metadata I/O from
struct inode. They are currently tied together pretty tightly.
Metadata reads happen via the ocfs2_read_blocks() functions, writes via both jbd2 and ocfs2_write_blocks().
- Each inode has a cache of associated metadata blocks stored on its ip_metadata_cache member. The ocfs2_read/write_blocks() functions take a struct inode to access this member.
- The journal mostly doesn't care about inodes. It does, however, need to set the transaction id on the inode so that dlmglue knows when an inode needs to checkpoint.
- All the metadata I/O paths use ip_io_mutex to synchronize their actions against each other.
The problem is that if someone wants to use our metadata I/O facilities, they have to have a struct inode. But not everything in ocfs2 is an inode (even if it seems that way sometimes). So we want to disconnect them.
It turns out that most of what goes on is about ocfs2_caching_info. So if we move the last few relevant bits to ocfs2_caching_info, we can then embed ocfs2_caching_info into another structure just as easily as we do inside struct inode. That's the theory, anyway.
The first three patches move the cache code to ocfs2_caching_info entirely. The functions affecting the metadata cache, like ocfs2_set_buffer_uptodate(), etc, take a struct ocfs2_caching_info instead of a struct inode. That sort of thing. It's nice and easy.
The next three patches move the journal transaction ids to struct ocfs2_caching_info. When they are done, the ocfs2_journal_access*() functions take a stuct ocfs2_caching_info, and the dlmglue checks the ocfs2_caching_info regarding checkpoints. So it only takes us six patches to isolate ocfs2_caching_info in the metadata I/O API.
The remaining 34 patches slowly but surely move alloc.c to the new API. Our btree code is heavily invested in the idea that all btrees are rooted, somehow, at an inode. Since we want to root a btree at a non-inode, we need to fix that. The good news, of course, is that the ocfs2_extent_tree abstraction is already there to rescue us. We attach the ocfs2_caching_info to a particular ocfs2_extent_tree, and we can then send that ocfs2_extent_tree down through the btree code. At the end of this series, the generic btree code doesn't reference struct inode at all.
There are a lot of patches because this entire series is supposed to be isomorphic. No behavior is to change, just the flexibility of our API. Thus, each patch tries to be readily understandable. Thank you for your patience!
[View]
http://oss.oracle.com/git/?p=jlbec/linux-2.6.git;a=shortlog;h=cacheme
[Pull]git://oss.oracle.com/git/jlbec/linux-2.6.git cacheme
Joel Becker (40):
ocfs2: Make the ocfs2_caching_info structure self-contained.
ocfs2: Change metadata caching locks to an operations structure.
ocfs2: Take the inode out of the metadata read/write paths.
ocfs2: move ip_last_trans to struct ocfs2_caching_info
ocfs2: move ip_created_trans to struct ocfs2_caching_info
ocfs2: Pass struct ocfs2_caching_info to the journal functions.
ocfs2: Store the ocfs2_caching_info on ocfs2_extent_tree.
ocfs2: Pass ocfs2_caching_info to ocfs2_read_extent_block().
ocfs2: ocfs2_find_path() only needs the caching info
ocfs2: ocfs2_create_new_meta_bhs() doesn't need struct inode.
ocfs2: Pass ocfs2_extent_tree to ocfs2_unlink_path()
ocfs2: ocfs2_complete_edge_insert() doesn't need struct inode at all.
ocfs2: Get inode out of ocfs2_rotate_subtree_root_right().
ocfs2: Pass ocfs2_extent_tree to ocfs2_get_subtree_root()
ocfs2: Drop struct inode from ocfs2_extent_tree_operations.
ocfs2: ocfs2_rotate_tree_right() doesn't need struct inode.
ocfs2: ocfs2_update_edge_lengths() doesn't need struct inode.
ocfs2: ocfs2_rotate_subtree_left() doesn't need struct inode.
ocfs2: __ocfs2_rotate_tree_left() doesn't need struct inode.
ocfs2: ocfs2_rotate_tree_left() no longer needs struct inode.
ocfs2: ocfs2_merge_rec_left/right() no longer need struct inode.
ocfs2: ocfs2_try_to_merge_extent() doesn't need struct inode.
ocfs2: ocfs2_grow_branch() no longer needs struct inode.
ocfs2: ocfs2_append_rec_to_path() loses struct inode.
ocfs2: ocfs2_truncate_rec() doesn't need struct inode.
ocfs2: Make truncating the extent map an extent_tree_operation.
ocfs2: ocfs2_insert_at_leaf() doesn't need struct inode.
ocfs2: Give ocfs2_split_record() an extent_tree instead of an inode.
ocfs2: ocfs2_do_insert_extent() and ocfs2_insert_path() no longer need an
ocfs2: ocfs2_extent_contig() only requires the superblock.
ocfs2: Swap inode for extent_tree in ocfs2_figure_merge_contig_type().
ocfs2: Remove inode from ocfs2_figure_extent_contig().
ocfs2: ocfs2_figure_insert_type() no longer needs struct inode.
ocfs2: Make extent map insertion an extent_tree_operation.
ocfs2: ocfs2_insert_extent() no longer needs struct inode.
ocfs2: ocfs2_add_clusters_in_btree() no longer needs struct inode.
ocfs2: ocfs2_remove_extent() no longer needs struct inode.
ocfs2: ocfs2_split_and_insert() no longer needs struct inode.
ocfs2: __ocfs2_mark_extent_written() doesn't need struct inode.
ocfs2: Pass ocfs2_caching_info into ocfs_init_*_extent_tree().
alloc.c | 896 ++++++++++++++++++++++++++++--------------------------- alloc.h | 33 -- aops.c | 10 buffer_head_io.c | 47 +- buffer_head_io.h | 8 dir.c | 38 +- dlmglue.c | 4 extent_map.c | 14 file.c | 21 - inode.c | 80 ++++ inode.h | 20 - journal.c | 53 +-- journal.h | 70 ++-- localalloc.c | 12 namei.c | 37 +- ocfs2.h | 38 ++ quota_global.c | 5 quota_local.c | 16 resize.c | 16 slot_map.c | 10 suballoc.c | 35 +- super.c | 5 uptodate.c | 265 +++++++++------- uptodate.h | 51 ++- xattr.c | 81 ++-- 25 files changed, 1056 insertions(+), 809 deletions(-)
PATCH 1/40 ocfs2: Make the ocfs2_caching_info structure self-contained.
We want to use the ocfs2_caching_info structure in places that are not inodes. To do that, it can no longer rely on referencing the inode directly.
This patch moves the flags to ocfs2_caching_info->ci_flags, stores pointers to the parent's locks on the ocfs2_caching_info, and renames the constants and flags to reflect its independant state.
--- fs/ocfs2/inode.c | 5 ++- fs/ocfs2/inode.h | 2 - fs/ocfs2/ocfs2.h | 23 +++++++++++- fs/ocfs2/super.c | 3 +- fs/ocfs2/uptodate.c | 99 ++++++++++++++++++++++++++------------------------ fs/ocfs2/uptodate.h | 4 ++- 6 files changed, 80 insertions(+), 56 deletions(-)
fs/ocfs2/inode.c +3 -2
@@ -1069,7 +1069,8 @@ void ocfs2_clear_inode(struct inode *inode)"Clear inode of %llu, inode has %u cache items\n" , (unsigned long long)oi->ip_blkno, oi->ip_metadata_cache.ci_num_cached); -mlog_bug_on_msg (!(oi->ip_flags &OCFS2_INODE_CACHE_INLINE ), +mlog_bug_on_msg (!(oi->ip_metadata_cache.ci_flags & +OCFS2_CACHE_FL_INLINE ),"Clear inode of %llu, inode has a bad flag\n" , (unsigned long long )oi->ip_blkno);
@@ -1096,7 +1097,7 @@ void ocfs2_clear_inode(struct inode *inode) (unsigned long long)oi->ip_blkno, oi->ip_open_count);/* Clear all other flags. */ - oi->ip_flags =OCFS2_INODE_CACHE_INLINE ; + oi->ip_flags =0 ; oi->ip_created_trans =0 ; oi->ip_last_trans =0 ; oi->ip_dir_start_lookup =0 ;
fs/ocfs2/inode.h +0 -2
@@ -102,8 +102,6 @@ struct ocfs2_inode_info#define OCFS2_INODE_MAYBE_ORPHANED 0x00000020/* Does someone have the file open O_DIRECT */ #define OCFS2_INODE_OPEN_DIRECT 0x00000040 -/* Indicates that the metadata cache should be used as an array. */ -#define OCFS2_INODE_CACHE_INLINE 0x00000080static inline struct ocfs2_inode_info *OCFS2_I (struct inode *inode) {
fs/ocfs2/ocfs2.h +21 -2
@@ -47,17 +47,36 @@#include "ocfs2_fs.h" #include "ocfs2_lockid.h" + +/* Caching of metadata buffers */ +/* 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 * amount of inlined blocks to be stored on an array and grow the * structure into a rb tree when necessary. */ -#define OCFS2_INODE_MAX_CACHE_ARRAY 2 +#define OCFS2_CACHE_INFO_MAX_ARRAY 2 + +/* Flags for ocfs2_caching_info */ + +enum ocfs2_caching_info_flags { +/* Indicates that the metadata cache is using the inline array */ +OCFS2_CACHE_FL_INLINE =1 <<1 , +};struct ocfs2_caching_info { +/* +* The parent structure provides the locks, but because the +* parent structure can differ, struct ocfs2_caching_info needs +* its own pointers to them. +*/ +spinlock_t *ci_lock; +struct mutex *ci_io_mutex; + +unsigned int ci_flags;unsigned int ci_num_cached;union { -sector_t ci_array[OCFS2_INODE_MAX_CACHE_ARRAY ]; +sector_t ci_array[OCFS2_CACHE_INFO_MAX_ARRAY ];struct rb_root ci_tree; } ci_cache; };
fs/ocfs2/super.c +2 -1
@@ -1463,7 +1463,8 @@ static void ocfs2_inode_init_once(void *data)ocfs2_lock_res_init_once (&oi->ip_inode_lockres);ocfs2_lock_res_init_once (&oi->ip_open_lockres); -ocfs2_metadata_cache_init (&oi->vfs_inode); +ocfs2_metadata_cache_init (&oi->ip_metadata_cache, &oi->ip_lock, + &oi->ip_io_mutex);inode_init_once (&oi->vfs_inode); }
fs/ocfs2/uptodate.c +51 -48
284 lines not on this page · raw message
fs/ocfs2/uptodate.h +3 -1
@@ -29,7 +29,9 @@int __init init_ocfs2_uptodate_cache (void );void exit_ocfs2_uptodate_cache (void ); -void ocfs2_metadata_cache_init (struct inode *inode); +void ocfs2_metadata_cache_init (struct ocfs2_caching_info *ci, +spinlock_t *cache_lock, +struct mutex *io_mutex);void ocfs2_metadata_cache_purge (struct inode *inode); int ocfs2_buffer_uptodate(struct inode *inode,
Signature · 1 line
1.5.6.5
PATCH 2/40 ocfs2: Change metadata caching locks to an operations structure.
In reply to Joel BeckerWe don't really want to cart around too many new fields on the ocfs2_caching_info structure. So let's wrap all our access of the parent object in a set of operations. One pointer on caching_info, and more flexibility to boot.
--- fs/ocfs2/inode.c | 49 +++++++++++++++++++ fs/ocfs2/inode.h | 1 + fs/ocfs2/ocfs2.h | 8 ++-- fs/ocfs2/super.c | 4 +- fs/ocfs2/uptodate.c | 129 +++++++++++++++++++++++++++++++++----------------- fs/ocfs2/uptodate.h | 30 +++++++++++- 6 files changed, 169 insertions(+), 52 deletions(-)
fs/ocfs2/inode.c +49 -0
@@ -1346,3 +1346,52 @@ int ocfs2_read_inode_block(struct inode *inode, struct buffer_head **bh) {return ocfs2_read_inode_block_full (inode, bh,0 ); } + +static struct ocfs2_inode_info *cache_info_to_inode (struct ocfs2_caching_info *ci) +{ + return container_of(ci, struct ocfs2_inode_info, ip_metadata_cache); +} + +static u64 ocfs2_inode_cache_owner (struct ocfs2_caching_info *ci) +{ +struct ocfs2_inode_info *oi =cache_info_to_inode (ci); + +return oi->ip_blkno; +} + +static void ocfs2_inode_cache_lock (struct ocfs2_caching_info *ci) +{ +struct ocfs2_inode_info *oi =cache_info_to_inode (ci); + +spin_lock (&oi->ip_lock); +} + +static void ocfs2_inode_cache_unlock (struct ocfs2_caching_info *ci) +{ +struct ocfs2_inode_info *oi =cache_info_to_inode (ci); + +spin_unlock (&oi->ip_lock); +} + +static void ocfs2_inode_cache_io_lock (struct ocfs2_caching_info *ci) +{ +struct ocfs2_inode_info *oi =cache_info_to_inode (ci); + +mutex_lock (&oi->ip_io_mutex); +} + +static void ocfs2_inode_cache_io_unlock (struct ocfs2_caching_info *ci) +{ +struct ocfs2_inode_info *oi =cache_info_to_inode (ci); + +mutex_unlock (&oi->ip_io_mutex); +} + +const struct ocfs2_caching_operations ocfs2_inode_caching_ops = { + .co_owner = ocfs2_inode_cache_owner, + .co_cache_lock = ocfs2_inode_cache_lock, + .co_cache_unlock = ocfs2_inode_cache_unlock, + .co_io_lock = ocfs2_inode_cache_io_lock, + .co_io_unlock = ocfs2_inode_cache_io_unlock, +}; +
fs/ocfs2/inode.h +1 -0
@@ -114,6 +114,7 @@ static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode)extern struct kmem_cache *ocfs2_inode_cache;extern const struct address_space_operations ocfs2_aops; +extern const struct ocfs2_caching_operations ocfs2_inode_caching_ops;void ocfs2_clear_inode (struct inode *inode);void ocfs2_delete_inode (struct inode *inode);
fs/ocfs2/ocfs2.h +4 -4
@@ -64,14 +64,14 @@ enum ocfs2_caching_info_flags { OCFS2_CACHE_FL_INLINE = 1<<1, }; +struct ocfs2_caching_operations ;struct ocfs2_caching_info {/* * The parent structure provides the locks, but because the -* parent structure can differ, struct ocfs2_caching_info needs -* its own pointers to them. +* parent structure can differ, it provides locking operations +* to struct ocfs2_caching_info. */ -spinlock_t *ci_lock; -struct mutex *ci_io_mutex; +const struct ocfs2_caching_operations *ci_ops;unsigned int ci_flags;unsigned int ci_num_cached;
fs/ocfs2/super.c +2 -2
@@ -1463,8 +1463,8 @@ static void ocfs2_inode_init_once(void *data)ocfs2_lock_res_init_once (&oi->ip_inode_lockres);ocfs2_lock_res_init_once (&oi->ip_open_lockres); -ocfs2_metadata_cache_init (&oi->ip_metadata_cache, &oi->ip_lock, - &oi->ip_io_mutex); +ocfs2_metadata_cache_init (&oi->ip_metadata_cache, + &ocfs2_inode_caching_ops);inode_init_once (&oi->vfs_inode); }
fs/ocfs2/uptodate.c +85 -44
272 lines not on this page · raw message
fs/ocfs2/uptodate.h +28 -2
@@ -26,12 +26,38 @@#ifndef OCFS2_UPTODATE_H #define OCFS2_UPTODATE_H +/* +* The caching code relies on locking provided by the user of +* struct ocfs2_caching_info. These operations connect that up. +*/ +struct ocfs2_caching_operations { +/* +* A u64 representing the owning structure. Usually this +* is the block number (i_blkno or whatnot). This is used so +* that caching log messages can identify the owning structure. +*/ +u64 (*co_owner)(struct ocfs2_caching_info *ci); + +/* +* Lock and unlock the caching data. These will not sleep, and +* should probably be spinlocks. +*/ +void (*co_cache_lock)(struct ocfs2_caching_info *ci); +void (*co_cache_unlock)(struct ocfs2_caching_info *ci); + +/* +* Lock and unlock for disk I/O. These will sleep, and should +* be mutexes. +*/ +void (*co_io_lock)(struct ocfs2_caching_info *ci); +void (*co_io_unlock)(struct ocfs2_caching_info *ci); +}; +int __init init_ocfs2_uptodate_cache (void );void exit_ocfs2_uptodate_cache (void );void ocfs2_metadata_cache_init (struct ocfs2_caching_info *ci, -spinlock_t *cache_lock, -struct mutex *io_mutex); +const struct ocfs2_caching_operations *ops);void ocfs2_metadata_cache_purge (struct inode *inode); int ocfs2_buffer_uptodate(struct inode *inode,
Signature · 1 line
1.5.6.5
PATCH 3/40 ocfs2: Take the inode out of the metadata read/write paths.
In reply to Joel BeckerWe are really passing the inode into the ocfs2_read/write_blocks() functions to get at the metadata cache. This commit passes the cache directly into the metadata block functions, divorcing them from the inode.
--- fs/ocfs2/alloc.c | 13 ++++--- fs/ocfs2/buffer_head_io.c | 47 +++++++++++++------------ fs/ocfs2/buffer_head_io.h | 8 ++-- fs/ocfs2/dir.c | 6 ++-- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/extent_map.c | 4 +- fs/ocfs2/inode.c | 16 ++++++-- fs/ocfs2/inode.h | 5 +++ fs/ocfs2/journal.c | 4 +- fs/ocfs2/localalloc.c | 2 +- fs/ocfs2/namei.c | 5 ++- fs/ocfs2/quota_global.c | 2 +- fs/ocfs2/resize.c | 2 +- fs/ocfs2/slot_map.c | 10 +++--- fs/ocfs2/suballoc.c | 4 +- fs/ocfs2/super.c | 2 +- fs/ocfs2/uptodate.c | 83 ++++++++++++++++++++------------------------ fs/ocfs2/uptodate.h | 21 +++++++---- fs/ocfs2/xattr.c | 23 +++++++----- 19 files changed, 139 insertions(+), 120 deletions(-)
fs/ocfs2/alloc.c +7 -6
@@ -795,7 +795,7 @@ int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno,int rc;struct buffer_head *tmp = *bh; - rc =ocfs2_read_block (inode, eb_blkno, &tmp, + rc =ocfs2_read_block (INODE_CACHE (inode), eb_blkno, &tmp, ocfs2_validate_extent_block);/* If ocfs2_read_block() got us a new bh, pass it up. */
@@ -885,7 +885,8 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,mlog_errno (status); goto bail; } -ocfs2_set_new_buffer_uptodate (inode, bhs[i]); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), + bhs[i]); status =ocfs2_journal_access_eb (handle, inode, bhs[i],OCFS2_JOURNAL_ACCESS_CREATE );
@@ -2404,7 +2405,7 @@ static void ocfs2_unlink_path(struct inode *inode, handle_t *handle, le16_to_cpu(el->l_next_free_rec));ocfs2_journal_dirty (handle, bh); -ocfs2_remove_from_cache (inode, bh); +ocfs2_remove_from_cache (INODE_CACHE (inode), bh);continue ; }
@@ -2417,7 +2418,7 @@ static void ocfs2_unlink_path(struct inode *inode, handle_t *handle,if (ret)mlog_errno (ret); -ocfs2_remove_from_cache (inode, bh); +ocfs2_remove_from_cache (INODE_CACHE (inode), bh); } }
@@ -5820,7 +5821,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb, tl->tl_used =0 ;ocfs2_compute_meta_ecc (osb->sb, tl_bh->b_data, &di->i_check); - status =ocfs2_write_block (osb, tl_bh, tl_inode); + status =ocfs2_write_block (osb, tl_bh,INODE_CACHE (tl_inode));if (status <0 ) {mlog_errno (status); goto bail;
@@ -6529,7 +6530,7 @@ delete:mlog (0 ,"deleting this extent block.\n" ); -ocfs2_remove_from_cache (inode, bh); +ocfs2_remove_from_cache (INODE_CACHE (inode), bh);BUG_ON (ocfs2_rec_clusters (el, &el->l_recs[0 ]));BUG_ON (le32_to_cpu (el->l_recs[0 ].e_cpos));
fs/ocfs2/buffer_head_io.c +24 -23
142 lines not on this page · raw message
fs/ocfs2/buffer_head_io.h +4 -4
@@ -33,7 +33,7 @@ void ocfs2_end_buffer_io_sync(struct buffer_head *bh,int ocfs2_write_block (struct ocfs2_super *osb,struct buffer_head *bh, -struct inode *inode); +struct ocfs2_caching_info *ci);int ocfs2_read_blocks_sync (struct ocfs2_super *osb,u64 block,unsigned int nr,struct buffer_head *bhs[]);
@@ -44,7 +44,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,* be set even for a READAHEAD call, as it marks the buffer for later * validation. */ -int ocfs2_read_blocks (struct inode *inode,u64 block,int nr, +int ocfs2_read_blocks (struct ocfs2_caching_info *ci,u64 block,int nr,struct buffer_head *bhs[],int flags,int (*validate)(struct super_block *sb,struct buffer_head *bh));
@@ -55,7 +55,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,#define OCFS2_BH_IGNORE_CACHE 1#define OCFS2_BH_READAHEAD 8 -static inline int ocfs2_read_block (struct inode *inode,u64 off, +static inline int ocfs2_read_block (struct ocfs2_caching_info *ci,u64 off,struct buffer_head **bh,int (*validate)(struct super_block *sb,struct buffer_head *bh))
@@ -68,7 +68,7 @@ static inline int ocfs2_read_block(struct inode *inode, u64 off, goto bail; } - status =ocfs2_read_blocks (inode, off,1 , bh,0 , validate); + status =ocfs2_read_blocks (ci, off,1 , bh,0 , validate); bail:return status;
fs/ocfs2/dir.c +3 -3
@@ -1299,7 +1299,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb, goto bail; } -ocfs2_set_new_buffer_uptodate (inode, new_bh); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), new_bh); status =ocfs2_journal_access_db (handle, inode, new_bh,OCFS2_JOURNAL_ACCESS_CREATE );
@@ -1477,7 +1477,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, goto out_commit; } -ocfs2_set_new_buffer_uptodate (dir, dirdata_bh); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (dir), dirdata_bh); ret =ocfs2_journal_access_db (handle, dir, dirdata_bh,OCFS2_JOURNAL_ACCESS_CREATE );
@@ -1769,7 +1769,7 @@ do_extend: goto bail; } -ocfs2_set_new_buffer_uptodate (dir, new_bh); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (dir), new_bh); status =ocfs2_journal_access_db (handle, dir, new_bh,OCFS2_JOURNAL_ACCESS_CREATE );
fs/ocfs2/dlmglue.c +1 -1
@@ -2046,7 +2046,7 @@ static int ocfs2_inode_lock_update(struct inode *inode,/* This will discard any caching information we might have had * for the inode metadata. */ -ocfs2_metadata_cache_purge (inode); +ocfs2_metadata_cache_purge (INODE_CACHE (inode));ocfs2_extent_map_trunc (inode,0 );
fs/ocfs2/extent_map.c +2 -2
@@ -862,8 +862,8 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,BUG_ON (bhs[done + i]->b_blocknr != (p_block + i)); } - rc =ocfs2_read_blocks (inode, p_block, count, bhs + done, - flags, validate); + rc =ocfs2_read_blocks (INODE_CACHE (inode), p_block, count, + bhs + done, flags, validate);if (rc) {mlog_errno (rc);break ;
fs/ocfs2/inode.c +12 -4
@@ -637,7 +637,7 @@ static int ocfs2_remove_inode(struct inode *inode, goto bail_commit; } -ocfs2_remove_from_cache (inode, di_bh); +ocfs2_remove_from_cache (INODE_CACHE (inode), di_bh);vfs_dq_free_inode (inode); status = ocfs2_free_dinode(handle, inode_alloc_inode,
@@ -1063,7 +1063,7 @@ void ocfs2_clear_inode(struct inode *inode)ocfs2_lock_res_free (&oi->ip_inode_lockres);ocfs2_lock_res_free (&oi->ip_open_lockres); -ocfs2_metadata_cache_purge (inode); +ocfs2_metadata_cache_purge (INODE_CACHE (inode)); mlog_bug_on_msg(oi->ip_metadata_cache.ci_num_cached, "Clear inode of %llu, inode has %u cache items\n",
@@ -1332,8 +1332,8 @@ int ocfs2_read_inode_block_full(struct inode *inode, struct buffer_head **bh,int rc;struct buffer_head *tmp = *bh; - rc =ocfs2_read_blocks (inode,OCFS2_I (inode)->ip_blkno,1 , &tmp, - flags, ocfs2_validate_inode_block); + rc =ocfs2_read_blocks (INODE_CACHE (inode),OCFS2_I (inode)->ip_blkno, +1 , &tmp, flags, ocfs2_validate_inode_block);/* If ocfs2_read_blocks() got us a new bh, pass it up. */ if (!rc && !*bh)
@@ -1359,6 +1359,13 @@ static u64 ocfs2_inode_cache_owner(struct ocfs2_caching_info *ci)return oi->ip_blkno; } +static struct super_block *ocfs2_inode_cache_get_super (struct ocfs2_caching_info *ci) +{ +struct ocfs2_inode_info *oi =cache_info_to_inode (ci); + +return oi->vfs_inode.i_sb; +} +static void ocfs2_inode_cache_lock (struct ocfs2_caching_info *ci) {struct ocfs2_inode_info *oi =cache_info_to_inode (ci);
@@ -1389,6 +1396,7 @@ static void ocfs2_inode_cache_io_unlock(struct ocfs2_caching_info *ci)const struct ocfs2_caching_operations ocfs2_inode_caching_ops = { .co_owner = ocfs2_inode_cache_owner, + .co_get_super = ocfs2_inode_cache_get_super, .co_cache_lock = ocfs2_inode_cache_lock, .co_cache_unlock = ocfs2_inode_cache_unlock, .co_io_lock = ocfs2_inode_cache_io_lock,
fs/ocfs2/inode.h +5 -0
@@ -116,6 +116,11 @@ extern struct kmem_cache *ocfs2_inode_cache;extern const struct address_space_operations ocfs2_aops;extern const struct ocfs2_caching_operations ocfs2_inode_caching_ops; +static inline struct ocfs2_caching_info *INODE_CACHE (struct inode *inode) +{ +return &OCFS2_I (inode)->ip_metadata_cache; +} +void ocfs2_clear_inode (struct inode *inode);void ocfs2_delete_inode (struct inode *inode);void ocfs2_drop_inode (struct inode *inode);
fs/ocfs2/journal.c +2 -2
@@ -780,7 +780,7 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,ocfs2_bump_recovery_generation (fe);ocfs2_compute_meta_ecc (osb->sb, bh->b_data, &fe->i_check); - status =ocfs2_write_block (osb, bh, journal->j_inode); + status =ocfs2_write_block (osb, bh,INODE_CACHE (journal->j_inode));if (status <0 )mlog_errno (status);
@@ -1515,7 +1515,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,ocfs2_get_recovery_generation (fe);ocfs2_compute_meta_ecc (osb->sb, bh->b_data, &fe->i_check); - status =ocfs2_write_block (osb, bh, inode); + status =ocfs2_write_block (osb, bh,INODE_CACHE (inode));if (status <0 )mlog_errno (status);
fs/ocfs2/localalloc.c +1 -1
@@ -478,7 +478,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,ocfs2_clear_local_alloc (alloc);ocfs2_compute_meta_ecc (osb->sb, alloc_bh->b_data, &alloc->i_check); - status =ocfs2_write_block (osb, alloc_bh, inode); + status =ocfs2_write_block (osb, alloc_bh,INODE_CACHE (inode));if (status <0 )mlog_errno (status);
fs/ocfs2/namei.c +3 -2
@@ -491,7 +491,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,mlog_errno (status); goto leave; } -ocfs2_set_new_buffer_uptodate (inode, *new_fe_bh); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), *new_fe_bh); status =ocfs2_journal_access_di (handle, inode, *new_fe_bh,OCFS2_JOURNAL_ACCESS_CREATE );
@@ -1508,7 +1508,8 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb,mlog_errno (status); goto bail; } -ocfs2_set_new_buffer_uptodate (inode, bhs[virtual]); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), + bhs[virtual]); status =ocfs2_journal_access (handle, inode, bhs[virtual],OCFS2_JOURNAL_ACCESS_CREATE );
fs/ocfs2/quota_global.c +1 -1
@@ -243,7 +243,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,flush_dcache_page (bh->b_page);set_buffer_uptodate (bh);unlock_buffer (bh); -ocfs2_set_buffer_uptodate (gqinode, bh); +ocfs2_set_buffer_uptodate (INODE_CACHE (gqinode), bh); err =ocfs2_journal_access_dq (handle, gqinode, bh, ja_type);if (err <0 ) {brelse (bh);
fs/ocfs2/resize.c +1 -1
@@ -514,7 +514,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) goto out_unlock; } -ocfs2_set_new_buffer_uptodate (inode, group_bh); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), group_bh); ret =ocfs2_verify_group_and_input (main_bm_inode, fe, input, group_bh);if (ret) {
fs/ocfs2/slot_map.c +5 -5
@@ -150,8 +150,8 @@ int ocfs2_refresh_slot_info(struct ocfs2_super *osb)* be !NULL. Thus, ocfs2_read_blocks() will ignore blocknr. If * this is not true, the read of -1 (UINT64_MAX) will fail. */ - ret =ocfs2_read_blocks (si->si_inode,-1 , si->si_blocks, si->si_bh, -OCFS2_BH_IGNORE_CACHE ,NULL ); + ret =ocfs2_read_blocks (INODE_CACHE (si->si_inode),-1 , si->si_blocks, + si->si_bh,OCFS2_BH_IGNORE_CACHE ,NULL );if (ret ==0 ) {spin_lock (&osb->osb_lock);ocfs2_update_slot_info (si);
@@ -213,7 +213,7 @@ static int ocfs2_update_disk_slot(struct ocfs2_super *osb,ocfs2_update_disk_slot_old (si, slot_num, &bh);spin_unlock (&osb->osb_lock); - status =ocfs2_write_block (osb, bh, si->si_inode); + status =ocfs2_write_block (osb, bh,INODE_CACHE (si->si_inode));if (status <0 )mlog_errno (status);
@@ -404,8 +404,8 @@ static int ocfs2_map_slot_buffers(struct ocfs2_super *osb, (unsigned long long)blkno); bh =NULL ;/* Acquire a fresh bh */ - status =ocfs2_read_blocks (si->si_inode, blkno,1 , &bh, -OCFS2_BH_IGNORE_CACHE ,NULL ); + status =ocfs2_read_blocks (INODE_CACHE (si->si_inode), blkno, +1 , &bh,OCFS2_BH_IGNORE_CACHE ,NULL );if (status <0 ) {mlog_errno (status); goto bail;
fs/ocfs2/suballoc.c +2 -2
@@ -306,7 +306,7 @@ int ocfs2_read_group_descriptor(struct inode *inode, struct ocfs2_dinode *di,int rc;struct buffer_head *tmp = *bh; - rc =ocfs2_read_block (inode, gd_blkno, &tmp, + rc =ocfs2_read_block (INODE_CACHE (inode), gd_blkno, &tmp, ocfs2_validate_group_descriptor);if (rc) goto out;
@@ -465,7 +465,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,mlog_errno (status); goto bail; } -ocfs2_set_new_buffer_uptodate (alloc_inode, bg_bh); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (alloc_inode), bg_bh); status = ocfs2_block_group_fill(handle, alloc_inode,
fs/ocfs2/super.c +1 -1
@@ -1463,7 +1463,7 @@ static void ocfs2_inode_init_once(void *data)ocfs2_lock_res_init_once (&oi->ip_inode_lockres);ocfs2_lock_res_init_once (&oi->ip_open_lockres); -ocfs2_metadata_cache_init (&oi->ip_metadata_cache, +ocfs2_metadata_cache_init (INODE_CACHE (&oi->vfs_inode), &ocfs2_inode_caching_ops);inode_init_once (&oi->vfs_inode);
fs/ocfs2/uptodate.c +38 -45
252 lines not on this page · raw message
fs/ocfs2/uptodate.h +14 -7
@@ -38,6 +38,8 @@ struct ocfs2_caching_operations {*/ u64 (*co_owner)(struct ocfs2_caching_info *ci); +/* The superblock is needed during I/O. */ +struct super_block *(*co_get_super)(struct ocfs2_caching_info *ci);/* * Lock and unlock the caching data. These will not sleep, and * should probably be spinlocks.
@@ -58,20 +60,25 @@ void exit_ocfs2_uptodate_cache(void);void ocfs2_metadata_cache_init (struct ocfs2_caching_info *ci,const struct ocfs2_caching_operations *ops); -void ocfs2_metadata_cache_purge (struct inode *inode); +void ocfs2_metadata_cache_purge (struct ocfs2_caching_info *ci); -int ocfs2_buffer_uptodate (struct inode *inode, +u64 ocfs2_metadata_cache_owner (struct ocfs2_caching_info *ci); +struct super_block *ocfs2_metadata_cache_get_super (struct ocfs2_caching_info *ci); +void ocfs2_metadata_cache_io_lock (struct ocfs2_caching_info *ci); +void ocfs2_metadata_cache_io_unlock (struct ocfs2_caching_info *ci); + +int ocfs2_buffer_uptodate (struct ocfs2_caching_info *ci,struct buffer_head *bh); -void ocfs2_set_buffer_uptodate (struct inode *inode, +void ocfs2_set_buffer_uptodate (struct ocfs2_caching_info *ci,struct buffer_head *bh); -void ocfs2_set_new_buffer_uptodate (struct inode *inode, +void ocfs2_set_new_buffer_uptodate (struct ocfs2_caching_info *ci,struct buffer_head *bh); -void ocfs2_remove_from_cache (struct inode *inode, +void ocfs2_remove_from_cache (struct ocfs2_caching_info *ci,struct buffer_head *bh); -void ocfs2_remove_xattr_clusters_from_cache (struct inode *inode, +void ocfs2_remove_xattr_clusters_from_cache (struct ocfs2_caching_info *ci,sector_t block,u32 c_len); -int ocfs2_buffer_read_ahead (struct inode *inode, +int ocfs2_buffer_read_ahead (struct ocfs2_caching_info *ci,struct buffer_head *bh);#endif /* OCFS2_UPTODATE_H */
fs/ocfs2/xattr.c +13 -10
@@ -253,9 +253,9 @@ static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket,break ; } -if (!ocfs2_buffer_uptodate (bucket->bu_inode, +if (!ocfs2_buffer_uptodate (INODE_CACHE (bucket->bu_inode), bucket->bu_bhs[i])) -ocfs2_set_new_buffer_uptodate (bucket->bu_inode, +ocfs2_set_new_buffer_uptodate (INODE_CACHE (bucket->bu_inode), bucket->bu_bhs[i]); }
@@ -270,7 +270,7 @@ static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket, {int rc; - rc =ocfs2_read_blocks (bucket->bu_inode, xb_blkno, + rc =ocfs2_read_blocks (INODE_CACHE (bucket->bu_inode), xb_blkno, bucket->bu_blocks, bucket->bu_bhs,0 ,NULL );if (!rc) {
@@ -394,7 +394,7 @@ static int ocfs2_read_xattr_block(struct inode *inode, u64 xb_blkno,int rc;struct buffer_head *tmp = *bh; - rc =ocfs2_read_block (inode, xb_blkno, &tmp, + rc =ocfs2_read_block (INODE_CACHE (inode), xb_blkno, &tmp, ocfs2_validate_xattr_block);/* If ocfs2_read_block() got us a new bh, pass it up. */
@@ -719,8 +719,8 @@ static int ocfs2_xattr_shrink_size(struct inode *inode, } block =ocfs2_clusters_to_blocks (inode->i_sb, phys_cpos); -ocfs2_remove_xattr_clusters_from_cache (inode, block, - alloc_size); +ocfs2_remove_xattr_clusters_from_cache (INODE_CACHE (inode), + block, alloc_size); cpos += alloc_size; trunc_len -= alloc_size; }
@@ -965,7 +965,8 @@ static int ocfs2_xattr_get_value_outside(struct inode *inode, blkno =ocfs2_clusters_to_blocks (inode->i_sb, p_cluster);/* Copy ocfs2_xattr_value */ for (i =0 ; i < num_clusters * bpc; i++, blkno++) { - ret =ocfs2_read_block (inode, blkno, &bh,NULL ); + ret =ocfs2_read_block (INODE_CACHE (inode), blkno, + &bh,NULL );if (ret) {mlog_errno (ret); goto out;
@@ -1202,7 +1203,8 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode, blkno =ocfs2_clusters_to_blocks (inode->i_sb, p_cluster);for (i =0 ; i < num_clusters * bpc; i++, blkno++) { - ret =ocfs2_read_block (inode, blkno, &bh,NULL ); + ret =ocfs2_read_block (INODE_CACHE (inode), blkno, + &bh,NULL );if (ret) {mlog_errno (ret); goto out;
@@ -2115,7 +2117,7 @@ static int ocfs2_xattr_block_set(struct inode *inode, } new_bh =sb_getblk (inode->i_sb, first_blkno); -ocfs2_set_new_buffer_uptodate (inode, new_bh); +ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), new_bh); ret =ocfs2_journal_access_xb (handle, inode, new_bh,OCFS2_JOURNAL_ACCESS_CREATE );
@@ -4823,7 +4825,8 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,mlog (0 ,"rm xattr extent rec at %u len = %u, start from %llu\n" , cpos, len, (unsigned long long )blkno); -ocfs2_remove_xattr_clusters_from_cache (inode, blkno, len); +ocfs2_remove_xattr_clusters_from_cache (INODE_CACHE (inode), blkno, + len); ret =ocfs2_lock_allocators (inode, &et,0 ,1 ,NULL , &meta_ac);if (ret) {
Signature · 1 line
1.5.6.5
PATCH 4/40 ocfs2: move ip_last_trans to struct ocfs2_caching_info
In reply to Joel BeckerWe have the read side of metadata caching isolated to struct ocfs2_caching_info, now we need the write side. This means the journal functions. The journal only does a couple of things with struct inode.
This change moves the ip_last_trans field onto struct ocfs2_caching_info as ci_last_trans. This field tells the journal whether a pending journal flush is required.
--- fs/ocfs2/inode.c | 10 +++++----- fs/ocfs2/inode.h | 2 -- fs/ocfs2/journal.h | 5 +++-- fs/ocfs2/ocfs2.h | 4 ++++ fs/ocfs2/super.c | 1 - fs/ocfs2/uptodate.c | 22 +++++++++++++++++++--- fs/ocfs2/uptodate.h | 1 + 7 files changed, 32 insertions(+), 13 deletions(-)
fs/ocfs2/inode.c +5 -5
@@ -1063,13 +1063,14 @@ void ocfs2_clear_inode(struct inode *inode)ocfs2_lock_res_free (&oi->ip_inode_lockres);ocfs2_lock_res_free (&oi->ip_open_lockres); -ocfs2_metadata_cache_purge (INODE_CACHE (inode)); +ocfs2_metadata_cache_exit (INODE_CACHE (inode)); -mlog_bug_on_msg (oi->ip_metadata_cache.ci_num_cached, +mlog_bug_on_msg (INODE_CACHE (inode)->ci_num_cached,"Clear inode of %llu, inode has %u cache items\n" , - (unsigned long long )oi->ip_blkno, oi->ip_metadata_cache.ci_num_cached); + (unsigned long long )oi->ip_blkno, +INODE_CACHE (inode)->ci_num_cached); -mlog_bug_on_msg (!(oi->ip_metadata_cache.ci_flags & +mlog_bug_on_msg (!(INODE_CACHE (inode)->ci_flags &OCFS2_CACHE_FL_INLINE ),"Clear inode of %llu, inode has a bad flag\n" , (unsigned long long )oi->ip_blkno);
@@ -1099,7 +1100,6 @@ void ocfs2_clear_inode(struct inode *inode)/* Clear all other flags. */ oi->ip_flags =0 ; oi->ip_created_trans =0 ; - oi->ip_last_trans =0 ; oi->ip_dir_start_lookup =0 ; oi->ip_blkno =0ULL ;
fs/ocfs2/inode.h +0 -2
@@ -63,8 +63,6 @@ struct ocfs2_inode_info/* next two are protected by trans_inc_lock */ /* which transaction were we created on? Zero if none. */ unsigned long ip_created_trans; -/* last transaction we were a part of. */ -unsigned long ip_last_trans;struct ocfs2_caching_info ip_metadata_cache;
fs/ocfs2/journal.h +3 -2
@@ -83,7 +83,7 @@ static inline void ocfs2_set_inode_lock_trans(struct ocfs2_journal *journal, struct inode *inode) {spin_lock (&trans_inc_lock); -OCFS2_I (inode)->ip_last_trans = journal->j_trans_id; +INODE_CACHE (inode)->ci_last_trans = journal->j_trans_id;spin_unlock (&trans_inc_lock); }
@@ -98,7 +98,8 @@ static inline int ocfs2_inode_fully_checkpointed(struct inode *inode)struct ocfs2_journal *journal =OCFS2_SB (inode->i_sb)->journal;spin_lock (&trans_inc_lock); - ret =time_after (journal->j_trans_id,OCFS2_I (inode)->ip_last_trans); + ret =time_after (journal->j_trans_id, +INODE_CACHE (inode)->ci_last_trans);spin_unlock (&trans_inc_lock);return ret; }
fs/ocfs2/ocfs2.h +4 -0
@@ -73,6 +73,10 @@ struct ocfs2_caching_info {*/ const struct ocfs2_caching_operations *ci_ops; +/* last transaction we were a part of. */ +unsigned long ci_last_trans; + +/* Cache structures */ unsigned int ci_flags;unsigned int ci_num_cached;union {
fs/ocfs2/super.c +0 -1
@@ -1449,7 +1449,6 @@ static void ocfs2_inode_init_once(void *data)ocfs2_extent_map_init (&oi->vfs_inode);INIT_LIST_HEAD (&oi->ip_io_markers); oi->ip_created_trans =0 ; - oi->ip_last_trans =0 ; oi->ip_dir_start_lookup =0 ;init_rwsem (&oi->ip_alloc_sem);
fs/ocfs2/uptodate.c +19 -3
@@ -118,16 +118,32 @@ void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci) } +static void ocfs2_metadata_cache_reset (struct ocfs2_caching_info *ci, +int clear) +{ + ci->ci_flags |=OCFS2_CACHE_FL_INLINE ; + ci->ci_num_cached =0 ; + +if (clear) + ci->ci_last_trans =0 ; +} +void ocfs2_metadata_cache_init (struct ocfs2_caching_info *ci,const struct ocfs2_caching_operations *ops) {BUG_ON (!ops); ci->ci_ops = ops; - ci->ci_flags |=OCFS2_CACHE_FL_INLINE ; - ci->ci_num_cached =0 ; +ocfs2_metadata_cache_reset (ci,1 ); +} + +void ocfs2_metadata_cache_exit (struct ocfs2_caching_info *ci) +{ +ocfs2_metadata_cache_purge (ci); +ocfs2_metadata_cache_reset (ci,1 ); } +/* No lock taken here as 'root' is not expected to be visible to other * processes. */ static unsigned int ocfs2_purge_copied_metadata_tree (struct rb_root *root)
@@ -177,7 +193,7 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci)if (tree) root = ci->ci_cache.ci_tree; -ocfs2_metadata_cache_init (ci, ci->ci_ops); +ocfs2_metadata_cache_reset (ci,0 );ocfs2_metadata_cache_unlock (ci); purged =ocfs2_purge_copied_metadata_tree (&root);
fs/ocfs2/uptodate.h +1 -0
@@ -61,6 +61,7 @@ void exit_ocfs2_uptodate_cache(void);void ocfs2_metadata_cache_init (struct ocfs2_caching_info *ci,const struct ocfs2_caching_operations *ops);void ocfs2_metadata_cache_purge (struct ocfs2_caching_info *ci); +void ocfs2_metadata_cache_exit (struct ocfs2_caching_info *ci);u64 ocfs2_metadata_cache_owner (struct ocfs2_caching_info *ci);struct super_block *ocfs2_metadata_cache_get_super (struct ocfs2_caching_info *ci);
Signature · 1 line
1.5.6.5
PATCH 4/40 ocfs2: move ip_last_trans to struct ocfs2_caching_info
Joel,
a minor comment see inline.
Quoted 32 lines · Joel Becker
We have the read side of metadata caching isolated to struct
ocfs2_caching_info, now we need the write side. This means the journal functions. The journal only does a couple of things with struct inode.This change moves the
ip_last_transfield onto structocfs2_caching_infoasci_last_trans. This field tells the journal whether a pending journal flush is required.Signed-off-by Joel Becker <[email protected]>--- fs/ocfs2/inode.c | 10 +++++----- fs/ocfs2/inode.h | 2 -- fs/ocfs2/journal.h | 5 +++-- fs/ocfs2/ocfs2.h | 4 ++++ fs/ocfs2/super.c | 1 - fs/ocfs2/uptodate.c | 22 +++++++++++++++++++--- fs/ocfs2/uptodate.h | 1 + 7 files changed, 32 insertions(+), 13 deletions(-)fs/ocfs2/inode.c +2
-2@@ -1063,13 +1063,14 @@ void ocfs2_clear_inode(struct inode *inode)ocfs2_lock_res_free (&oi->ip_inode_lockres);ocfs2_lock_res_free (&oi->ip_open_lockres); -ocfs2_metadata_cache_purge (INODE_CACHE (inode)); +ocfs2_metadata_cache_exit (INODE_CACHE (inode)); - mlog_bug_on_msg(oi->ip_metadata_cache.ci_num_cached, + mlog_bug_on_msg(INODE_CACHE(inode)->ci_num_cached,
fs/ocfs2/inode.c void ocfs2_clear_inode(struct inode *inode) · line 1076
Quoted 10 lines
fs/ocfs2/inode.c +3
-2"Clear inode of %llu, inode has %u cache items\n" , - (unsigned long long)oi->ip_blkno, oi->ip_metadata_cache.ci_num_cached); + (unsigned long long )oi->ip_blkno, + INODE_CACHE(inode)->ci_num_cached); -mlog_bug_on_msg (!(oi->ip_metadata_cache.ci_flags & +mlog_bug_on_msg (!(INODE_CACHE (inode)->ci_flags &OCFS2_CACHE_FL_INLINE ),"Clear inode of %llu, inode has a bad flag\n" , (unsigned long long )oi->ip_blkno);
These 2 lines(mlog) has nothing to do with your ip_last_trans, why change them? And if you really want to change it, it may be included in the patch you add INODE_CACHE I guess?
Regards,
Tao
PATCH 4/40 ocfs2: move ip_last_trans to struct ocfs2_caching_info
Quoted 35 lines · Tao Ma
Quoted 34 lines · Joel Becker
We have the read side of metadata caching isolated to struct
ocfs2_caching_info, now we need the write side. This means the journal functions. The journal only does a couple of things with struct inode.This change moves the
ip_last_transfield onto structocfs2_caching_infoasci_last_trans. This field tells the journal whether a pending journal flush is required.Signed-off-by Joel Becker <[email protected]>--- fs/ocfs2/inode.c | 10 +++++----- fs/ocfs2/inode.h | 2 -- fs/ocfs2/journal.h | 5 +++-- fs/ocfs2/ocfs2.h | 4 ++++ fs/ocfs2/super.c | 1 - fs/ocfs2/uptodate.c | 22 +++++++++++++++++++--- fs/ocfs2/uptodate.h | 1 + 7 files changed, 32 insertions(+), 13 deletions(-)fs/ocfs2/inode.c +4
-1@@ -1063,13 +1063,14 @@ void ocfs2_clear_inode(struct inode *inode)ocfs2_lock_res_free (&oi->ip_inode_lockres);ocfs2_lock_res_free (&oi->ip_open_lockres); -ocfs2_metadata_cache_purge (INODE_CACHE (inode)); +ocfs2_metadata_cache_exit (INODE_CACHE (inode)); -mlog_bug_on_msg (oi->ip_metadata_cache.ci_num_cached, +mlog_bug_on_msg (INODE_CACHE (inode)->ci_num_cached,"Clear inode of %llu, inode has %u cache items\n" , - (unsigned long long )oi->ip_blkno, oi->ip_metadata_cache.ci_num_cached); + (unsigned long long )oi->ip_blkno, + INODE_CACHE(inode)->ci_num_cached);
Quoted 8 lines
fs/ocfs2/inode.c void ocfs2_clear_inode(struct inode *inode) · line 1076
Quoted 5 lines
fs/ocfs2/inode.c +1
-0- mlog_bug_on_msg(!(oi->ip_metadata_cache.ci_flags & + mlog_bug_on_msg(!(INODE_CACHE(inode)->ci_flags & OCFS2_CACHE_FL_INLINE), "Clear inode of %llu, inode has a bad flag\n", (unsigned long long)oi->ip_blkno);These 2 lines(mlog) has nothing to do with your
ip_last_trans, why change them? And if you really want to change it, it may be included in the patch you addINODE_CACHEI guess?
I do want to change it. I thought I had it against the previous
patch. Whoops?
Joel
Signature · 9 lines
"Here's something to think about: How come you never see a headline like ``Psychic Wins Lottery''?" - Jay Leno Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
PATCH 5/40 ocfs2: move ip_created_trans to struct ocfs2_caching_info
In reply to Joel BeckerSimilar ip_last_trans, ip_created_trans tracks the creation of a journal managed inode. This specifically tracks what transaction created the inode. This is so the code can know if the inode has ever been written to disk.
This behavior is desirable for any journal managed object. We move it to struct ocfs2_caching_info as ci_created_trans so that any object using ocfs2_caching_info can rely on this behavior.
--- fs/ocfs2/inode.c | 1 - fs/ocfs2/inode.h | 4 ---- fs/ocfs2/journal.h | 6 +++--- fs/ocfs2/ocfs2.h | 3 +++ fs/ocfs2/super.c | 1 - fs/ocfs2/uptodate.c | 4 +++- 6 files changed, 9 insertions(+), 10 deletions(-)
fs/ocfs2/inode.c +0 -1
@@ -1099,7 +1099,6 @@ void ocfs2_clear_inode(struct inode *inode)/* Clear all other flags. */ oi->ip_flags =0 ; - oi->ip_created_trans =0 ; oi->ip_dir_start_lookup =0 ; oi->ip_blkno =0ULL ;
fs/ocfs2/inode.h +0 -4
@@ -60,10 +60,6 @@ struct ocfs2_inode_infou32 ip_dir_start_lookup; -/* next two are protected by trans_inc_lock */ -/* which transaction were we created on? Zero if none. */ -unsigned long ip_created_trans; -struct ocfs2_caching_info ip_metadata_cache;struct ocfs2_extent_map ip_extent_map;
fs/ocfs2/journal.h +3 -3
@@ -118,9 +118,9 @@ static inline int ocfs2_inode_is_new(struct inode *inode)return 0 ;spin_lock (&trans_inc_lock); ret = !(time_after (OCFS2_SB (inode->i_sb)->journal->j_trans_id, -OCFS2_I (inode)->ip_created_trans)); +INODE_CACHE (inode)->ci_created_trans));if (!ret) -OCFS2_I (inode)->ip_created_trans =0 ; +INODE_CACHE (inode)->ci_created_trans =0 ;spin_unlock (&trans_inc_lock);return ret; }
@@ -129,7 +129,7 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb, struct inode *inode) {spin_lock (&trans_inc_lock); -OCFS2_I (inode)->ip_created_trans = osb->journal->j_trans_id; +INODE_CACHE (inode)->ci_created_trans = osb->journal->j_trans_id;spin_unlock (&trans_inc_lock); }
fs/ocfs2/ocfs2.h +3 -0
@@ -73,6 +73,9 @@ struct ocfs2_caching_info {*/ const struct ocfs2_caching_operations *ci_ops; +/* next two are protected by trans_inc_lock */ +/* which transaction were we created on? Zero if none. */ +unsigned long ci_created_trans;/* last transaction we were a part of. */ unsigned long ci_last_trans;
fs/ocfs2/super.c +0 -1
@@ -1448,7 +1448,6 @@ static void ocfs2_inode_init_once(void *data)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_dir_start_lookup =0 ;init_rwsem (&oi->ip_alloc_sem);
fs/ocfs2/uptodate.c +3 -1
@@ -124,8 +124,10 @@ static void ocfs2_metadata_cache_reset(struct ocfs2_caching_info *ci, ci->ci_flags |=OCFS2_CACHE_FL_INLINE ; ci->ci_num_cached =0 ; -if (clear) +if (clear) { + ci->ci_created_trans =0 ; ci->ci_last_trans =0 ; + } } void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci,
Signature · 1 line
1.5.6.5
PATCH 5/40 ocfs2: move ip_created_trans to struct ocfs2_caching_info
Quoted 10 lines · Joel Becker
Similar
ip_last_trans,ip_created_transtracks the creation of a journal managed inode. This specifically tracks what transaction created the inode. This is so the code can know if the inode has ever been written to disk.This behavior is desirable for any journal managed object. We move it to struct
ocfs2_caching_infoasci_created_transso that any object usingocfs2_caching_infocan rely on this behavior.Signed-off-by Joel Becker <[email protected]>
<snip>
Quoted 5 lines
index ef75dbb..ff4b526 100644
fs/ocfs2/journal.h +0
-0@@ -118,9 +118,9 @@ static inline int ocfs2_inode_is_new(struct inode *inode)return 0 ;
fs/ocfs2/journal.h static inline int ocfs2_inode_is_new(struct inode *inode) · line 126
Quoted 10 lines
fs/ocfs2/journal.h +2
-2spin_lock (&trans_inc_lock); ret = !(time_after (OCFS2_SB (inode->i_sb)->journal->j_trans_id, -OCFS2_I (inode)->ip_created_trans)); +INODE_CACHE (inode)->ci_created_trans));if (!ret) -OCFS2_I (inode)->ip_created_trans =0 ; +INODE_CACHE (inode)->ci_created_trans =0 ;spin_unlock (&trans_inc_lock);return ret; }
A question unrelated to your modification. Why we use "!time_after" and then check "!ret". I guess a "time_after" and "ret" is ok.
Regards,
Tao
PATCH 5/40 ocfs2: move ip_created_trans to struct ocfs2_caching_info
Quoted 21 lines · Tao Ma
Quoted 10 lines · Joel Becker
Similar
ip_last_trans,ip_created_transtracks the creation of a journal managed inode. This specifically tracks what transaction created the inode. This is so the code can know if the inode has ever been written to disk.This behavior is desirable for any journal managed object. We move it to struct
ocfs2_caching_infoasci_created_transso that any object usingocfs2_caching_infocan rely on this behavior.Signed-off-by Joel Becker <[email protected]><snip>
Quoted 9 lines
index ef75dbb..ff4b526 100644
fs/ocfs2/journal.h +1
-1@@ -118,9 +118,9 @@ static inline int ocfs2_inode_is_new(struct inode *inode)return 0 ;spin_lock (&trans_inc_lock); ret = !(time_after (OCFS2_SB (inode->i_sb)->journal->j_trans_id, -OCFS2_I (inode)->ip_created_trans)); +INODE_CACHE (inode)->ci_created_trans));
Quoted 8 lines
fs/ocfs2/journal.h static inline int ocfs2_inode_is_new(struct inode *inode) · line 126
Quoted 6 lines
fs/ocfs2/journal.h +1
-1if (!ret) -OCFS2_I (inode)->ip_created_trans =0 ; +INODE_CACHE (inode)->ci_created_trans =0 ;spin_unlock (&trans_inc_lock);return ret; }A question unrelated to your modification. Why we use "!time_after" and then check "!ret". I guess a "
time_after" and "ret" is ok.
I presume because we're returning ret to the caller. We want
ret to be 1 if the time_after() is false.
Joel
Signature · 8 lines
"Against stupidity the Gods themselves contend in vain." - Friedrich von Schiller Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127
PATCH 5/40 ocfs2: move ip_created_trans to struct ocfs2_caching_info
Quoted 31 lines · Joel Becker
Quoted 21 lines · Tao Ma
Quoted 10 lines · Joel Becker
Similar
ip_last_trans,ip_created_transtracks the creation of a journal managed inode. This specifically tracks what transaction created the inode. This is so the code can know if the inode has ever been written to disk.This behavior is desirable for any journal managed object. We move it to struct
ocfs2_caching_infoasci_created_transso that any object usingocfs2_caching_infocan rely on this behavior.Signed-off-by Joel Becker <[email protected]><snip>
Quoted 9 lines
index ef75dbb..ff4b526 100644
fs/ocfs2/journal.h +1
-1@@ -118,9 +118,9 @@ static inline int ocfs2_inode_is_new(struct inode *inode)return 0 ;spin_lock (&trans_inc_lock); ret = !(time_after (OCFS2_SB (inode->i_sb)->journal->j_trans_id, -OCFS2_I (inode)->ip_created_trans)); +INODE_CACHE (inode)->ci_created_trans));Quoted 8 lines
fs/ocfs2/journal.h static inline int ocfs2_inode_is_new(struct inode *inode) · line 126
Quoted 6 lines
fs/ocfs2/journal.h +1
-1if (!ret) -OCFS2_I (inode)->ip_created_trans =0 ; +INODE_CACHE (inode)->ci_created_trans =0 ;spin_unlock (&trans_inc_lock);return ret; }A question unrelated to your modification. Why we use "!time_after" and then check "!ret". I guess a "
time_after" and "ret" is ok.
Quoted 2 lines
I presume because we're returning ret to the caller. We want
ret to be 1 if thetime_after()is false.
aha, yes. Thanks.
Regards,
Tao
PATCH 6/40 ocfs2: Pass struct ocfs2_caching_info to the journal functions.
In reply to Joel BeckerThe next step in divorcing metadata I/O management from struct inode is to pass struct ocfs2_caching_info to the journal functions. Thus the journal locks a metadata cache with the cache io_lock function. It also can compare ci_last_trans and ci_created_trans directly.
This is a large patch because of all the places we change ocfs2_journal_access..(handle, inode, ...) to ocfs2_journal_access..(handle, INODE_CACHE(inode), ...).
--- fs/ocfs2/alloc.c | 97 ++++++++++++++++++++++++----------------------- fs/ocfs2/aops.c | 4 +- fs/ocfs2/dir.c | 21 ++++++---- fs/ocfs2/dlmglue.c | 2 +- fs/ocfs2/file.c | 8 ++-- fs/ocfs2/inode.c | 7 ++- fs/ocfs2/journal.c | 49 ++++++++++++----------- fs/ocfs2/journal.h | 71 +++++++++++++++++++--------------- fs/ocfs2/localalloc.c | 10 +++-- fs/ocfs2/namei.c | 32 ++++++++++----- fs/ocfs2/ocfs2.h | 8 +++- fs/ocfs2/quota_global.c | 3 +- fs/ocfs2/quota_local.c | 16 +++++--- fs/ocfs2/resize.c | 14 +++--- fs/ocfs2/suballoc.c | 29 +++++++------- fs/ocfs2/uptodate.h | 1 - fs/ocfs2/xattr.c | 34 +++++++++------- 17 files changed, 225 insertions(+), 181 deletions(-)
fs/ocfs2/alloc.c +49 -48
@@ -357,11 +357,11 @@ static inline void ocfs2_et_update_clusters(struct inode *inode, }static inline int ocfs2_et_root_journal_access (handle_t *handle, -struct inode *inode, +struct ocfs2_caching_info *ci,struct ocfs2_extent_tree *et,int type) { -return et->et_root_journal_access (handle, inode, et->et_root_bh, +return et->et_root_journal_access (handle, ci, et->et_root_bh, type); }
@@ -569,7 +569,7 @@ static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et)* ocfs2_journal_access_path(), but I don't have a better one. */ static int ocfs2_path_bh_journal_access (handle_t *handle, -struct inode *inode, +struct ocfs2_caching_info *ci,struct ocfs2_path *path,int idx) {
@@ -581,14 +581,15 @@ static int ocfs2_path_bh_journal_access(handle_t *handle,if (idx) access = ocfs2_journal_access_eb; -return access (handle, inode, path->p_node[idx].bh, +return access (handle, ci, path->p_node[idx].bh,OCFS2_JOURNAL_ACCESS_WRITE ); }/* * Convenience function to journal all components in a path. */ -static int ocfs2_journal_access_path (struct inode *inode,handle_t *handle, +static int ocfs2_journal_access_path (struct ocfs2_caching_info *ci, +handle_t *handle,struct ocfs2_path *path) {int i, ret =0 ;
@@ -597,7 +598,7 @@ static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle, goto out;for (i =0 ; i <path_num_items (path); i++) { - ret =ocfs2_path_bh_journal_access (handle, inode, path, i); + ret =ocfs2_path_bh_journal_access (handle, ci, path, i);if (ret <0 ) {mlog_errno (ret); goto out;
@@ -888,7 +889,7 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), bhs[i]); - status =ocfs2_journal_access_eb (handle, inode, bhs[i], + status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), bhs[i],OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1032,7 +1033,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,BUG_ON (!OCFS2_IS_VALID_EXTENT_BLOCK (eb)); eb_el = &eb->h_list; - status =ocfs2_journal_access_eb (handle, inode, bh, + status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1072,20 +1073,20 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,* journal_dirty erroring as it won't unless we've aborted the * handle (in which case we would never be here) so reserving * the write with journal_access is all we need to do. */ - status =ocfs2_journal_access_eb (handle, inode, *last_eb_bh, + status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), *last_eb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status); goto bail; } - status =ocfs2_et_root_journal_access (handle, inode, et, + status =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status); goto bail; }if (eb_bh) { - status =ocfs2_journal_access_eb (handle, inode, eb_bh, + status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), eb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1175,7 +1176,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, eb_el = &eb->h_list; root_el = et->et_root_el; - status =ocfs2_journal_access_eb (handle, inode, new_eb_bh, + status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), new_eb_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1194,7 +1195,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, goto bail; } - status =ocfs2_et_root_journal_access (handle, inode, et, + status =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1964,7 +1965,7 @@ static int ocfs2_rotate_subtree_right(struct inode *inode, root_bh = left_path->p_node[subtree_index].bh;BUG_ON (root_bh != right_path->p_node[subtree_index].bh); - ret =ocfs2_path_bh_journal_access (handle, inode, right_path, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -1972,14 +1973,14 @@ static int ocfs2_rotate_subtree_right(struct inode *inode, }for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), left_path, i);if (ret) {mlog_errno (ret);
@@ -2499,7 +2500,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,return -EAGAIN ;if (le16_to_cpu (right_leaf_el->l_next_free_rec) >1 ) { - ret =ocfs2_journal_access_eb (handle, inode, + ret =ocfs2_journal_access_eb (handle,INODE_CACHE (inode),path_leaf_bh (right_path),OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {
@@ -2518,7 +2519,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,* We have to update i_last_eb_blk during the meta * data delete. */ - ret =ocfs2_et_root_journal_access (handle, inode, et, + ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -2534,7 +2535,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,*/ BUG_ON (right_has_empty && !del_right_subtree); - ret =ocfs2_path_bh_journal_access (handle, inode, right_path, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -2542,14 +2543,14 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, }for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), left_path, i);if (ret) {mlog_errno (ret);
@@ -2704,7 +2705,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,if (!ocfs2_is_empty_extent (&el->l_recs[0 ]))return 0 ; - ret =ocfs2_path_bh_journal_access (handle, inode, path, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), path,path_num_items (path) -1 );if (ret) {mlog_errno (ret);
@@ -2787,7 +2788,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,* Caller might still want to make changes to the * tree root, so re-add it to the journal here. */ - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), left_path,0 );if (ret) {mlog_errno (ret);
@@ -2865,7 +2866,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_journal_access_path (inode, handle, path); + ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, path);if (ret) {mlog_errno (ret); goto out;
@@ -2895,7 +2896,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_journal_access_path (inode, handle, left_path); + ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, left_path);if (ret) {mlog_errno (ret); goto out;
@@ -3205,7 +3206,7 @@ static int ocfs2_merge_rec_right(struct inode *inode, root_bh = left_path->p_node[subtree_index].bh;BUG_ON (root_bh != right_path->p_node[subtree_index].bh); - ret =ocfs2_path_bh_journal_access (handle, inode, right_path, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -3214,14 +3215,14 @@ static int ocfs2_merge_rec_right(struct inode *inode,for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), left_path, i);if (ret) {mlog_errno (ret);
@@ -3234,7 +3235,7 @@ static int ocfs2_merge_rec_right(struct inode *inode, right_rec = &el->l_recs[index +1 ]; } - ret =ocfs2_path_bh_journal_access (handle, inode, left_path, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), left_path,path_num_items (left_path) -1 );if (ret) {mlog_errno (ret);
@@ -3374,7 +3375,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, root_bh = left_path->p_node[subtree_index].bh;BUG_ON (root_bh != right_path->p_node[subtree_index].bh); - ret =ocfs2_path_bh_journal_access (handle, inode, right_path, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -3383,14 +3384,14 @@ static int ocfs2_merge_rec_left(struct inode *inode,for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle, inode, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), left_path, i);if (ret) {mlog_errno (ret);
@@ -3403,7 +3404,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, has_empty_extent =1 ; } - ret =ocfs2_path_bh_journal_access (handle, inode, right_path, + ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path,path_num_items (right_path) -1 );if (ret) {mlog_errno (ret);
@@ -3841,7 +3842,7 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle, } } - ret =ocfs2_journal_access_path (inode, handle, right_path); + ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, right_path);if (ret) {mlog_errno (ret); goto out;
@@ -3970,7 +3971,7 @@ static int ocfs2_insert_path(struct inode *inode, goto out; } - ret =ocfs2_journal_access_path (inode, handle, left_path); + ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, left_path);if (ret <0 ) {mlog_errno (ret); goto out;
@@ -3981,7 +3982,7 @@ static int ocfs2_insert_path(struct inode *inode,* Pass both paths to the journal. The majority of inserts * will be touching all components anyway. */ - ret =ocfs2_journal_access_path (inode, handle, right_path); + ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, right_path);if (ret <0 ) {mlog_errno (ret); goto out;
@@ -4046,7 +4047,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, el = et->et_root_el; - ret =ocfs2_et_root_journal_access (handle, inode, et, + ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -4108,7 +4109,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,* ocfs2_rotate_tree_right() might have extended the * transaction without re-journaling our tree root. */ - ret =ocfs2_et_root_journal_access (handle, inode, et, + ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -4631,7 +4632,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,BUG_ON (num_bits > clusters_to_add);/* reserve our write early -- insert_extent may update the tree root */ - status =ocfs2_et_root_journal_access (handle, inode, et, + status =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -5143,13 +5144,13 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_journal_access_path (inode, handle, path); + ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, path);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_journal_access_path (inode, handle, left_path); + ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, left_path);if (ret) {mlog_errno (ret); goto out;
@@ -5384,7 +5385,7 @@ int ocfs2_remove_btree_range(struct inode *inode, goto out; } - ret =ocfs2_et_root_journal_access (handle, inode, et, + ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -5501,7 +5502,7 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, goto bail; } - status =ocfs2_journal_access_di (handle, tl_inode, tl_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (tl_inode), tl_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -5563,7 +5564,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,while (i >=0 ) {/* Caller has given us at least enough credits to * update the truncate log dinode */ - status =ocfs2_journal_access_di (handle, tl_inode, tl_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (tl_inode), tl_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -6580,14 +6581,14 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,* Each component will be touched, so we might as well journal * here to avoid having to handle errors later. */ - status =ocfs2_journal_access_path (inode, handle, path); + status =ocfs2_journal_access_path (INODE_CACHE (inode), handle, path);if (status <0 ) {mlog_errno (status); goto bail; }if (last_eb_bh) { - status =ocfs2_journal_access_eb (handle, inode, last_eb_bh, + status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), last_eb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -6949,7 +6950,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, goto out_unlock; } - ret =ocfs2_journal_access_di (handle, inode, di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -7318,7 +7319,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh, goto out; } - ret =ocfs2_journal_access_di (handle, inode, di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
fs/ocfs2/aops.c +2 -2
@@ -1512,7 +1512,7 @@ static int ocfs2_write_begin_inline(struct address_space *mapping, goto out; } - ret =ocfs2_journal_access_di (handle, inode, wc->w_di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), wc->w_di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {ocfs2_commit_trans (osb, handle);
@@ -1740,7 +1740,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,* We don't want this to fail in ocfs2_write_end(), so do it * here. */ - ret =ocfs2_journal_access_di (handle, inode, wc->w_di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), wc->w_di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
fs/ocfs2/dir.c +12 -9
@@ -523,7 +523,8 @@ int ocfs2_update_entry(struct inode *dir, handle_t *handle,if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) access = ocfs2_journal_access_di; - ret =access (handle, dir, de_bh,OCFS2_JOURNAL_ACCESS_WRITE ); + ret =access (handle,INODE_CACHE (dir), de_bh, +OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret); goto out;
@@ -562,7 +563,7 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, goto bail; }if (de == de_del) { - status =access (handle, dir, bh, + status =access (handle,INODE_CACHE (dir), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) { status = -EIO ;
@@ -734,11 +735,13 @@ int __ocfs2_add_entry(handle_t *handle, }if (insert_bh == parent_fe_bh) - status =ocfs2_journal_access_di (handle, dir, + status =ocfs2_journal_access_di (handle, +INODE_CACHE (dir), insert_bh,OCFS2_JOURNAL_ACCESS_WRITE );else - status =ocfs2_journal_access_db (handle, dir, + status =ocfs2_journal_access_db (handle, +INODE_CACHE (dir), insert_bh,OCFS2_JOURNAL_ACCESS_WRITE );/* By now the buffer is marked for journaling */
@@ -1248,7 +1251,7 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb,struct ocfs2_inline_data *data = &di->id2.i_data;unsigned int size =le16_to_cpu (data->id_count); - ret =ocfs2_journal_access_di (handle, inode, di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -1301,7 +1304,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), new_bh); - status =ocfs2_journal_access_db (handle, inode, new_bh, + status =ocfs2_journal_access_db (handle,INODE_CACHE (inode), new_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1479,7 +1482,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,ocfs2_set_new_buffer_uptodate (INODE_CACHE (dir), dirdata_bh); - ret =ocfs2_journal_access_db (handle, dir, dirdata_bh, + ret =ocfs2_journal_access_db (handle,INODE_CACHE (dir), dirdata_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (ret) {mlog_errno (ret);
@@ -1507,7 +1510,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,* We let the later dirent insert modify c/mtime - to the user * the data hasn't changed. */ - ret =ocfs2_journal_access_di (handle, dir, di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (dir), di_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (ret) {mlog_errno (ret);
@@ -1771,7 +1774,7 @@ do_extend:ocfs2_set_new_buffer_uptodate (INODE_CACHE (dir), new_bh); - status =ocfs2_journal_access_db (handle, dir, new_bh, + status =ocfs2_journal_access_db (handle,INODE_CACHE (dir), new_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
fs/ocfs2/dlmglue.c +1 -1
@@ -3341,7 +3341,7 @@ static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres, int new_level) {struct inode *inode =ocfs2_lock_res_inode (lockres); -int checkpointed =ocfs2_inode_fully_checkpointed (inode); +int checkpointed =ocfs2_ci_fully_checkpointed (INODE_CACHE (inode));BUG_ON (new_level !=DLM_LOCK_NL && new_level !=DLM_LOCK_PR );BUG_ON (lockres->l_level !=DLM_LOCK_EX && !checkpointed);
fs/ocfs2/file.c +4 -4
@@ -256,7 +256,7 @@ int ocfs2_update_inode_atime(struct inode *inode, goto out; } - ret =ocfs2_journal_access_di (handle, inode, bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -353,7 +353,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb, goto out; } - status =ocfs2_journal_access_di (handle, inode, fe_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (inode), fe_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -590,7 +590,7 @@ restarted_transaction:/* reserve a write to the file entry early on - that we if we * run out of credits in the allocation path, we can still * update i_size. */ - status =ocfs2_journal_access_di (handle, inode, bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (inode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1121,7 +1121,7 @@ static int __ocfs2_write_remove_suid(struct inode *inode, goto out; } - ret =ocfs2_journal_access_di (handle, inode, bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret);
fs/ocfs2/inode.c +4 -3
@@ -537,7 +537,8 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, goto out; } - status =ocfs2_journal_access_di (handle, inode, fe_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (inode), + fe_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -621,7 +622,7 @@ static int ocfs2_remove_inode(struct inode *inode, }/* set the inodes dtime */ - status =ocfs2_journal_access_di (handle, inode, di_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1190,7 +1191,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle,mlog_entry ("(inode %llu)\n" , (unsigned long long )OCFS2_I (inode)->ip_blkno); - status =ocfs2_journal_access_di (handle, inode, bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (inode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
fs/ocfs2/journal.c +26 -23
122 lines not on this page · raw message
fs/ocfs2/journal.h +40 -31
136 lines not on this page · raw message
fs/ocfs2/localalloc.c +6 -4
@@ -383,8 +383,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) }memcpy (alloc_copy, alloc, bh->b_size); - status =ocfs2_journal_access_di (handle, local_alloc_inode, bh, -OCFS2_JOURNAL_ACCESS_WRITE ); + status =ocfs2_journal_access_di (handle,INODE_CACHE (local_alloc_inode), + bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status); goto out_commit;
@@ -764,7 +764,8 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,* delete bits from it! */ *num_bits = bits_wanted; - status =ocfs2_journal_access_di (handle, local_alloc_inode, + status =ocfs2_journal_access_di (handle, +INODE_CACHE (local_alloc_inode), osb->local_alloc_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {
@@ -1242,7 +1243,8 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, }memcpy (alloc_copy, alloc, osb->local_alloc_bh->b_size); - status =ocfs2_journal_access_di (handle, local_alloc_inode, + status =ocfs2_journal_access_di (handle, +INODE_CACHE (local_alloc_inode), osb->local_alloc_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {
fs/ocfs2/namei.c +21 -11
@@ -361,7 +361,8 @@ static int ocfs2_mknod(struct inode *dir, goto leave; } - status =ocfs2_journal_access_di (handle, dir, parent_fe_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (dir), + parent_fe_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -493,7 +494,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, }ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), *new_fe_bh); - status =ocfs2_journal_access_di (handle, inode, *new_fe_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (inode), + *new_fe_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -547,7 +549,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, }ocfs2_populate_inode (inode, fe,1 ); -ocfs2_inode_set_new (osb, inode); +ocfs2_ci_set_new (osb,INODE_CACHE (inode));if (!ocfs2_mount_local (osb)) { status =ocfs2_create_new_inode_locks (inode);if (status <0 )
@@ -664,7 +666,7 @@ static int ocfs2_link(struct dentry *old_dentry, goto out_unlock_inode; } - err =ocfs2_journal_access_di (handle, inode, fe_bh, + err =ocfs2_journal_access_di (handle,INODE_CACHE (inode), fe_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (err <0 ) {mlog_errno (err);
@@ -851,7 +853,7 @@ static int ocfs2_unlink(struct inode *dir, goto leave; } - status =ocfs2_journal_access_di (handle, inode, fe_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (inode), fe_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1265,7 +1267,8 @@ static int ocfs2_rename(struct inode *old_dir, goto bail; } } - status =ocfs2_journal_access_di (handle, new_inode, newfe_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (new_inode), + newfe_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1312,7 +1315,8 @@ static int ocfs2_rename(struct inode *old_dir, old_inode->i_ctime =CURRENT_TIME ;mark_inode_dirty (old_inode); - status =ocfs2_journal_access_di (handle, old_inode, old_inode_bh, + status =ocfs2_journal_access_di (handle,INODE_CACHE (old_inode), + old_inode_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status >=0 ) { old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
@@ -1389,7 +1393,8 @@ static int ocfs2_rename(struct inode *old_dir, (int)old_dir_nlink, old_dir->i_nlink); }else {struct ocfs2_dinode *fe; - status =ocfs2_journal_access_di (handle, old_dir, + status =ocfs2_journal_access_di (handle, +INODE_CACHE (old_dir), old_dir_bh,OCFS2_JOURNAL_ACCESS_WRITE ); fe = (struct ocfs2_dinode *) old_dir_bh->b_data;
@@ -1511,7 +1516,8 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb,ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), bhs[virtual]); - status =ocfs2_journal_access (handle, inode, bhs[virtual], + status =ocfs2_journal_access (handle,INODE_CACHE (inode), + bhs[virtual],OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1899,7 +1905,9 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, goto leave; } - status =ocfs2_journal_access_di (handle, orphan_dir_inode, orphan_dir_bh, + status =ocfs2_journal_access_di (handle, +INODE_CACHE (orphan_dir_inode), + orphan_dir_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1987,7 +1995,9 @@ int ocfs2_orphan_del(struct ocfs2_super *osb, goto leave; } - status =ocfs2_journal_access_di (handle,orphan_dir_inode, orphan_dir_bh, + status =ocfs2_journal_access_di (handle, +INODE_CACHE (orphan_dir_inode), + orphan_dir_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
fs/ocfs2/ocfs2.h +7 -1
@@ -87,6 +87,11 @@ struct ocfs2_caching_info {struct rb_root ci_tree; } ci_cache; }; +/* +* Need this prototype here instead of in uptodate.h because journal.h +* uses it. +*/ +struct super_block *ocfs2_metadata_cache_get_super (struct ocfs2_caching_info *ci);/* this limits us to 256 nodes * if we need more, we can do a kmalloc for the map */
@@ -372,7 +377,8 @@ struct ocfs2_super#define OCFS2_SB (sb) ((struct ocfs2_super *)(sb)->s_fs_info)/* Useful typedef for passing around journal access functions */ -typedef int (*ocfs2_journal_access_func )(handle_t *handle,struct inode *inode, +typedef int (*ocfs2_journal_access_func )(handle_t *handle, +struct ocfs2_caching_info *ci,struct buffer_head *bh,int type);static inline int ocfs2_should_order_data (struct inode *inode)
fs/ocfs2/quota_global.c +2 -1
@@ -244,7 +244,8 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,set_buffer_uptodate (bh);unlock_buffer (bh);ocfs2_set_buffer_uptodate (INODE_CACHE (gqinode), bh); - err =ocfs2_journal_access_dq (handle, gqinode, bh, ja_type); + err =ocfs2_journal_access_dq (handle,INODE_CACHE (gqinode), bh, + ja_type);if (err <0 ) {brelse (bh); goto out;
fs/ocfs2/quota_local.c +10 -6
@@ -106,7 +106,7 @@ static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh,mlog_errno (status);return status; } - status =ocfs2_journal_access_dq (handle, inode, bh, + status =ocfs2_journal_access_dq (handle,INODE_CACHE (inode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -506,7 +506,8 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode, goto out_commit; }/* Release local quota file entry */ - status =ocfs2_journal_access_dq (handle, lqinode, + status =ocfs2_journal_access_dq (handle, +INODE_CACHE (lqinode), qbh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -614,7 +615,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,mlog_errno (status); goto out_bh; } - status =ocfs2_journal_access_dq (handle, lqinode, bh, + status =ocfs2_journal_access_dq (handle,INODE_CACHE (lqinode), + bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -981,7 +983,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( goto out; } - status =ocfs2_journal_access_dq (handle, lqinode, bh, + status =ocfs2_journal_access_dq (handle,INODE_CACHE (lqinode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1074,7 +1076,8 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(mlog_errno (status); goto out; } - status =ocfs2_journal_access_dq (handle, lqinode, chunk->qc_headerbh, + status =ocfs2_journal_access_dq (handle,INODE_CACHE (lqinode), + chunk->qc_headerbh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1207,7 +1210,8 @@ static int ocfs2_local_release_dquot(struct dquot *dquot) goto out; } - status =ocfs2_journal_access_dq (handle,sb_dqopt (sb)->files[type], + status =ocfs2_journal_access_dq (handle, +INODE_CACHE (sb_dqopt (sb)->files[type]), od->dq_chunk->qc_headerbh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
fs/ocfs2/resize.c +7 -7
@@ -106,8 +106,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,mlog_entry ("(new_clusters=%d, first_new_cluster = %u)\n" , new_clusters, first_new_cluster); - ret =ocfs2_journal_access_gd (handle, bm_inode, group_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); + ret =ocfs2_journal_access_gd (handle,INODE_CACHE (bm_inode), + group_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret); goto out;
@@ -141,7 +141,7 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle, }/* update the inode accordingly. */ - ret =ocfs2_journal_access_di (handle, bm_inode, bm_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (bm_inode), bm_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret);
@@ -536,8 +536,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) cl = &fe->id2.i_chain; cr = &cl->cl_recs[input->chain]; - ret =ocfs2_journal_access_gd (handle, main_bm_inode, group_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); + ret =ocfs2_journal_access_gd (handle,INODE_CACHE (main_bm_inode), + group_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret); goto out_commit;
@@ -552,8 +552,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) goto out_commit; } - ret =ocfs2_journal_access_di (handle, main_bm_inode, main_bm_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); + ret =ocfs2_journal_access_di (handle,INODE_CACHE (main_bm_inode), + main_bm_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret); goto out_commit;
fs/ocfs2/suballoc.c +15 -14
@@ -348,7 +348,7 @@ static int ocfs2_block_group_fill(handle_t *handle, } status =ocfs2_journal_access_gd (handle, - alloc_inode, +INODE_CACHE (alloc_inode), bg_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {
@@ -480,7 +480,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb, bg = (struct ocfs2_group_desc *) bg_bh->b_data; - status =ocfs2_journal_access_di (handle, alloc_inode, + status =ocfs2_journal_access_di (handle,INODE_CACHE (alloc_inode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -991,7 +991,7 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle, journal_type =OCFS2_JOURNAL_ACCESS_UNDO ; status =ocfs2_journal_access_gd (handle, - alloc_inode, +INODE_CACHE (alloc_inode), group_bh, journal_type);if (status <0 ) {
@@ -1064,7 +1064,8 @@ static int ocfs2_relink_block_group(handle_t *handle, bg_ptr =le64_to_cpu (bg->bg_next_group); prev_bg_ptr =le64_to_cpu (prev_bg->bg_next_group); - status =ocfs2_journal_access_gd (handle, alloc_inode, prev_bg_bh, + status =ocfs2_journal_access_gd (handle,INODE_CACHE (alloc_inode), + prev_bg_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1079,8 +1080,8 @@ static int ocfs2_relink_block_group(handle_t *handle, goto out_rollback; } - status =ocfs2_journal_access_gd (handle, alloc_inode, bg_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); + status =ocfs2_journal_access_gd (handle,INODE_CACHE (alloc_inode), + bg_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status); goto out_rollback;
@@ -1094,8 +1095,8 @@ static int ocfs2_relink_block_group(handle_t *handle, goto out_rollback; } - status =ocfs2_journal_access_di (handle, alloc_inode, fe_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); + status =ocfs2_journal_access_di (handle,INODE_CACHE (alloc_inode), + fe_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status); goto out_rollback;
@@ -1246,7 +1247,7 @@ static int ocfs2_alloc_dinode_update_counts(struct inode *inode,struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain; - ret =ocfs2_journal_access_di (handle, inode, di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret);
@@ -1419,7 +1420,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,/* Ok, claim our bits now: set the info on dinode, chainlist * and then the group */ status =ocfs2_journal_access_di (handle, - alloc_inode, +INODE_CACHE (alloc_inode), ac->ac_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {
@@ -1828,8 +1829,8 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle,if (ocfs2_is_cluster_bitmap (alloc_inode)) journal_type =OCFS2_JOURNAL_ACCESS_UNDO ; - status =ocfs2_journal_access_gd (handle, alloc_inode, group_bh, - journal_type); + status =ocfs2_journal_access_gd (handle,INODE_CACHE (alloc_inode), + group_bh, journal_type);if (status <0 ) {mlog_errno (status); goto bail;
@@ -1904,8 +1905,8 @@ int ocfs2_free_suballoc_bits(handle_t *handle, goto bail; } - status =ocfs2_journal_access_di (handle, alloc_inode, alloc_bh, -OCFS2_JOURNAL_ACCESS_WRITE ); + status =ocfs2_journal_access_di (handle,INODE_CACHE (alloc_inode), + alloc_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status); goto bail;
fs/ocfs2/uptodate.h +0 -1
@@ -64,7 +64,6 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci);void ocfs2_metadata_cache_exit (struct ocfs2_caching_info *ci);u64 ocfs2_metadata_cache_owner (struct ocfs2_caching_info *ci); -struct super_block *ocfs2_metadata_cache_get_super (struct ocfs2_caching_info *ci);void ocfs2_metadata_cache_io_lock (struct ocfs2_caching_info *ci);void ocfs2_metadata_cache_io_unlock (struct ocfs2_caching_info *ci);
fs/ocfs2/xattr.c +19 -15
@@ -294,7 +294,8 @@ static int ocfs2_xattr_bucket_journal_access(handle_t *handle,int i, rc =0 ;for (i =0 ; i < bucket->bu_blocks; i++) { - rc =ocfs2_journal_access (handle, bucket->bu_inode, + rc =ocfs2_journal_access (handle, +INODE_CACHE (bucket->bu_inode), bucket->bu_bhs[i], type);if (rc) {mlog_errno (rc);
@@ -599,7 +600,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,ocfs2_init_xattr_value_extent_tree (&et, inode, vb); - status = vb->vb_access (handle, inode, vb->vb_bh, + status = vb->vb_access (handle,INODE_CACHE (inode), vb->vb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -653,7 +654,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,ocfs2_init_xattr_value_extent_tree (&et, inode, vb); - ret = vb->vb_access (handle, inode, vb->vb_bh, + ret = vb->vb_access (handle,INODE_CACHE (inode), vb->vb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -1211,7 +1212,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode, } ret =ocfs2_journal_access (handle, - inode, +INODE_CACHE (inode), bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {
@@ -1262,7 +1263,7 @@ static int ocfs2_xattr_cleanup(struct inode *inode,void *val = xs->base + offs;size_t size =OCFS2_XATTR_SIZE (name_len) +OCFS2_XATTR_ROOT_SIZE ; - ret = vb->vb_access (handle, inode, vb->vb_bh, + ret = vb->vb_access (handle,INODE_CACHE (inode), vb->vb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -1290,7 +1291,7 @@ static int ocfs2_xattr_update_entry(struct inode *inode, {int ret; - ret = vb->vb_access (handle, inode, vb->vb_bh, + ret = vb->vb_access (handle,INODE_CACHE (inode), vb->vb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -1611,7 +1612,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, } } - ret =ocfs2_journal_access_di (handle, inode, xs->inode_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), xs->inode_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -1619,7 +1620,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode, }if (!(flag &OCFS2_INLINE_XATTR_FL )) { - ret = vb.vb_access (handle, inode, vb.vb_bh, + ret = vb.vb_access (handle,INODE_CACHE (inode), vb.vb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -1892,7 +1893,7 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)mlog_errno (ret); goto out; } - ret =ocfs2_journal_access_di (handle, inode, di_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), di_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -2101,7 +2102,8 @@ static int ocfs2_xattr_block_set(struct inode *inode,int ret;if (!xs->xattr_bh) { - ret =ocfs2_journal_access_di (handle, inode, xs->inode_bh, + ret =ocfs2_journal_access_di (handle,INODE_CACHE (inode), + xs->inode_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (ret <0 ) {mlog_errno (ret);
@@ -2119,7 +2121,8 @@ static int ocfs2_xattr_block_set(struct inode *inode, new_bh =sb_getblk (inode->i_sb, first_blkno);ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), new_bh); - ret =ocfs2_journal_access_xb (handle, inode, new_bh, + ret =ocfs2_journal_access_xb (handle,INODE_CACHE (inode), + new_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (ret <0 ) {mlog_errno (ret);
@@ -2594,7 +2597,8 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,if (!ret) {/* Update inode ctime. */ - ret =ocfs2_journal_access (ctxt->handle, inode, xis->inode_bh, + ret =ocfs2_journal_access (ctxt->handle,INODE_CACHE (inode), + xis->inode_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -3420,7 +3424,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,*/ down_write (&oi->ip_alloc_sem); - ret =ocfs2_journal_access_xb (handle, inode, xb_bh, + ret =ocfs2_journal_access_xb (handle,INODE_CACHE (inode), xb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -4259,7 +4263,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,ocfs2_init_xattr_tree_extent_tree (&et, inode, root_bh); - ret =ocfs2_journal_access_xb (handle, inode, root_bh, + ret =ocfs2_journal_access_xb (handle,INODE_CACHE (inode), root_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret <0 ) {mlog_errno (ret);
@@ -4851,7 +4855,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode, goto out; } - ret =ocfs2_journal_access_xb (handle, inode, root_bh, + ret =ocfs2_journal_access_xb (handle,INODE_CACHE (inode), root_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
Signature · 1 line
1.5.6.5
PATCH 6/40 ocfs2: Pass struct ocfs2_caching_info to the journal functions.
love this patch very much. :)
Regards,
Tao
Quoted 10 lines · Joel Becker
The next step in divorcing metadata I/O management from struct inode is to pass struct
ocfs2_caching_infoto the journal functions. Thus the journal locks a metadata cache with the cacheio_lockfunction. It also can compareci_last_transandci_created_transdirectly.This is a large patch because of all the places we change ocfs2_journal_access..(handle, inode, ...) to ocfs2_journal_access..(handle,
INODE_CACHE(inode), ...).Signed-off-by Joel Becker <[email protected]>
PATCH 7/40 ocfs2: Store the ocfs2_caching_info on ocfs2_extent_tree.
In reply to Joel BeckerWhat do we cache? Metadata blocks. What are most of our non-inode metadata blocks? Extent blocks for our btrees. struct ocfs2_extent_tree is the main structure for managing those. So let's store the associated ocfs2_caching_info there.
This means that ocfs2_et_root_journal_access() doesn't need struct inode anymore, and any place that has an et can refer to et->et_ci instead of INODE_CACHE(inode).
--- fs/ocfs2/alloc.c | 26 +++++++++++++------------- fs/ocfs2/alloc.h | 4 +++- 2 files changed, 16 insertions(+), 14 deletions(-)
fs/ocfs2/alloc.c +13 -13
@@ -302,6 +302,7 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, { et->et_ops = ops; et->et_root_bh = bh; + et->et_ci =INODE_CACHE (inode); et->et_root_journal_access = access;if (!obj) obj = (void *)bh->b_data;
@@ -357,11 +358,10 @@ static inline void ocfs2_et_update_clusters(struct inode *inode, }static inline int ocfs2_et_root_journal_access (handle_t *handle, -struct ocfs2_caching_info *ci,struct ocfs2_extent_tree *et,int type) { -return et->et_root_journal_access (handle, ci, et->et_root_bh, +return et->et_root_journal_access (handle, et->et_ci, et->et_root_bh, type); }
@@ -1079,7 +1079,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,mlog_errno (status); goto bail; } - status =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et, + status =ocfs2_et_root_journal_access (handle, et,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1195,7 +1195,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, goto bail; } - status =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et, + status =ocfs2_et_root_journal_access (handle, et,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -2519,7 +2519,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,* We have to update i_last_eb_blk during the meta * data delete. */ - ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et, + ret =ocfs2_et_root_journal_access (handle, et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -2866,7 +2866,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, path); + ret =ocfs2_journal_access_path (et->et_ci, handle, path);if (ret) {mlog_errno (ret); goto out;
@@ -2896,7 +2896,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, left_path); + ret =ocfs2_journal_access_path (et->et_ci, handle, left_path);if (ret) {mlog_errno (ret); goto out;
@@ -4047,7 +4047,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, el = et->et_root_el; - ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et, + ret =ocfs2_et_root_journal_access (handle, et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -4109,7 +4109,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,* ocfs2_rotate_tree_right() might have extended the * transaction without re-journaling our tree root. */ - ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et, + ret =ocfs2_et_root_journal_access (handle, et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
@@ -4632,7 +4632,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,BUG_ON (num_bits > clusters_to_add);/* reserve our write early -- insert_extent may update the tree root */ - status =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et, + status =ocfs2_et_root_journal_access (handle, et,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -5144,13 +5144,13 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, path); + ret =ocfs2_journal_access_path (et->et_ci, handle, path);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, left_path); + ret =ocfs2_journal_access_path (et->et_ci, handle, left_path);if (ret) {mlog_errno (ret); goto out;
@@ -5385,7 +5385,7 @@ int ocfs2_remove_btree_range(struct inode *inode, goto out; } - ret =ocfs2_et_root_journal_access (handle,INODE_CACHE (inode), et, + ret =ocfs2_et_root_journal_access (handle, et,OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {mlog_errno (ret);
fs/ocfs2/alloc.h +3 -1
@@ -45,7 +45,8 @@* * ocfs2_extent_tree contains info for the root of the b-tree, it must have a * root ocfs2_extent_list and a root_bh so that they can be used in the b-tree -* functions. With metadata ecc, we now call different journal_access +* functions. It needs the ocfs2_caching_info structure associated with +* I/O on the tree. With metadata ecc, we now call different journal_access * functions for each type of metadata, so it must have the * root_journal_access function. * ocfs2_extent_tree_operations abstract the normal operations we do for
@@ -56,6 +57,7 @@ struct ocfs2_extent_tree {struct ocfs2_extent_tree_operations *et_ops;struct buffer_head *et_root_bh;struct ocfs2_extent_list *et_root_el; +struct ocfs2_caching_info *et_ci;ocfs2_journal_access_func et_root_journal_access;void *et_object;unsigned int et_max_leaf_clusters;
Signature · 1 line
1.5.6.5
PATCH 8/40 ocfs2: Pass ocfs2_caching_info to ocfs2_read_extent_block().
In reply to Joel Beckerextent blocks belong to btrees on more than just inodes, so we want to pass the ocfs2_caching_info structure directly to ocfs2_read_extent_block(). A number of places in alloc.c can now drop struct inode from their argument list.
--- fs/ocfs2/alloc.c | 38 ++++++++++++++++++++------------------ fs/ocfs2/alloc.h | 3 +-- fs/ocfs2/dir.c | 2 +- fs/ocfs2/extent_map.c | 4 ++-- fs/ocfs2/suballoc.c | 2 +- 5 files changed, 25 insertions(+), 24 deletions(-)
fs/ocfs2/alloc.c +20 -18
@@ -790,13 +790,13 @@ static int ocfs2_validate_extent_block(struct super_block *sb,return 0 ; } -int ocfs2_read_extent_block (struct inode *inode,u64 eb_blkno, +int ocfs2_read_extent_block (struct ocfs2_caching_info *ci,u64 eb_blkno,struct buffer_head **bh) {int rc;struct buffer_head *tmp = *bh; - rc =ocfs2_read_block (INODE_CACHE (inode), eb_blkno, &tmp, + rc =ocfs2_read_block (ci, eb_blkno, &tmp, ocfs2_validate_extent_block);/* If ocfs2_read_block() got us a new bh, pass it up. */
@@ -811,7 +811,6 @@ int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno,* How many free extents have we got before we need more meta data? */ int ocfs2_num_free_extents (struct ocfs2_super *osb, -struct inode *inode,struct ocfs2_extent_tree *et) {int retval;
@@ -826,7 +825,8 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb, last_eb_blk =ocfs2_et_get_last_eb_blk (et);if (last_eb_blk) { - retval =ocfs2_read_extent_block (inode, last_eb_blk, &eb_bh); + retval =ocfs2_read_extent_block (et->et_ci, last_eb_blk, + &eb_bh);if (retval <0 ) {mlog_errno (retval); goto bail;
@@ -1252,7 +1252,6 @@ bail:* return status < 0 indicates an error. */ static int ocfs2_find_branch_target (struct ocfs2_super *osb, -struct inode *inode,struct ocfs2_extent_tree *et,struct buffer_head **target_bh) {
@@ -1271,19 +1270,21 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,while (le16_to_cpu (el->l_tree_depth) >1 ) {if (le16_to_cpu (el->l_next_free_rec) ==0 ) { -ocfs2_error (inode->i_sb,"Dinode %llu has empty " +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci), +"Owner %llu has empty " "extent list (next_free_rec == 0)" , - (unsigned long long )OCFS2_I (inode)->ip_blkno); + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci)); status = -EIO ; goto bail; } i =le16_to_cpu (el->l_next_free_rec) -1 ; blkno =le64_to_cpu (el->l_recs[i].e_blkno);if (!blkno) { -ocfs2_error (inode->i_sb,"Dinode %llu has extent " +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci), +"Owner %llu has extent " "list where extent # %d has no physical " "block start" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, i); + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), i); status = -EIO ; goto bail; }
@@ -1291,7 +1292,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,brelse (bh); bh =NULL ; - status =ocfs2_read_extent_block (inode, blkno, &bh); + status =ocfs2_read_extent_block (et->et_ci, blkno, &bh);if (status <0 ) {mlog_errno (status); goto bail;
@@ -1345,7 +1346,7 @@ static int ocfs2_grow_tree(struct inode *inode, handle_t *handle,BUG_ON (meta_ac ==NULL ); - shift =ocfs2_find_branch_target (osb, inode, et, &bh); + shift =ocfs2_find_branch_target (osb, et, &bh);if (shift <0 ) { ret = shift;mlog_errno (ret);
@@ -1650,7 +1651,7 @@ static int __ocfs2_find_path(struct inode *inode,brelse (bh); bh =NULL ; - ret =ocfs2_read_extent_block (inode, blkno, &bh); + ret =ocfs2_read_extent_block (INODE_CACHE (inode), blkno, &bh);if (ret) {mlog_errno (ret); goto out;
@@ -2872,7 +2873,8 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_find_cpos_for_left_leaf (inode->i_sb, path, &cpos); + ret =ocfs2_find_cpos_for_left_leaf (ocfs2_metadata_cache_get_super (et->et_ci), + path, &cpos);if (ret) {mlog_errno (ret); goto out;
@@ -4392,7 +4394,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,* ocfs2_figure_insert_type() and ocfs2_add_branch() * may want it later. */ - ret =ocfs2_read_extent_block (inode, + ret =ocfs2_read_extent_block (et->et_ci,ocfs2_et_get_last_eb_blk (et), &bh);if (ret) {
@@ -4595,7 +4597,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,if (mark_unwritten) flags =OCFS2_EXT_UNWRITTEN ; - free_extents =ocfs2_num_free_extents (osb, inode, et); + free_extents =ocfs2_num_free_extents (osb, et);if (free_extents <0 ) { status = free_extents;mlog_errno (status);
@@ -4860,7 +4862,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,if (path->p_tree_depth) {struct ocfs2_extent_block *eb; - ret =ocfs2_read_extent_block (inode, + ret =ocfs2_read_extent_block (et->et_ci,ocfs2_et_get_last_eb_blk (et), &last_eb_bh);if (ret) {
@@ -5013,7 +5015,7 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, depth = path->p_tree_depth;if (depth >0 ) { - ret =ocfs2_read_extent_block (inode, + ret =ocfs2_read_extent_block (et->et_ci,ocfs2_et_get_last_eb_blk (et), &last_eb_bh);if (ret <0 ) {
@@ -7257,7 +7259,7 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb,ocfs2_init_dealloc_ctxt (&(*tc)->tc_dealloc);if (fe->id2.i_list.l_tree_depth) { - status =ocfs2_read_extent_block (inode, + status =ocfs2_read_extent_block (INODE_CACHE (inode),le64_to_cpu (fe->i_last_eb_blk), &last_eb_bh);if (status <0 ) {
fs/ocfs2/alloc.h +1 -2
@@ -83,7 +83,7 @@ void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,* allocated. This is a cached read. The extent block will be validated * with ocfs2_validate_extent_block(). */ -int ocfs2_read_extent_block (struct inode *inode,u64 eb_blkno, +int ocfs2_read_extent_block (struct ocfs2_caching_info *ci,u64 eb_blkno,struct buffer_head **bh);struct ocfs2_alloc_context ;
@@ -129,7 +129,6 @@ int ocfs2_remove_btree_range(struct inode *inode, struct ocfs2_cached_dealloc_ctxt *dealloc);int ocfs2_num_free_extents (struct ocfs2_super *osb, -struct inode *inode,struct ocfs2_extent_tree *et);/*
fs/ocfs2/dir.c +1 -1
@@ -1724,7 +1724,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,if (dir_i_size ==ocfs2_clusters_to_bytes (sb,OCFS2_I (dir)->ip_clusters)) {spin_unlock (&OCFS2_I (dir)->ip_lock);ocfs2_init_dinode_extent_tree (&et, dir, parent_fe_bh); - num_free_extents =ocfs2_num_free_extents (osb, dir, &et); + num_free_extents =ocfs2_num_free_extents (osb, &et);if (num_free_extents <0 ) { status = num_free_extents;mlog_errno (status);
fs/ocfs2/extent_map.c +2 -2
@@ -293,7 +293,7 @@ static int ocfs2_last_eb_is_empty(struct inode *inode,struct ocfs2_extent_block *eb;struct ocfs2_extent_list *el; - ret =ocfs2_read_extent_block (inode, last_eb_blk, &eb_bh); + ret =ocfs2_read_extent_block (INODE_CACHE (inode), last_eb_blk, &eb_bh);if (ret) {mlog_errno (ret); goto out;
@@ -375,7 +375,7 @@ static int ocfs2_figure_hole_clusters(struct inode *inode,if (le64_to_cpu (eb->h_next_leaf_blk) ==0ULL ) goto no_more_extents; - ret =ocfs2_read_extent_block (inode, + ret =ocfs2_read_extent_block (INODE_CACHE (inode),le64_to_cpu (eb->h_next_leaf_blk), &next_eb_bh);if (ret) {
fs/ocfs2/suballoc.c +1 -1
@@ -2063,7 +2063,7 @@ int ocfs2_lock_allocators(struct inode *inode,BUG_ON (clusters_to_add !=0 && data_ac ==NULL ); - num_free_extents =ocfs2_num_free_extents (osb, inode, et); + num_free_extents =ocfs2_num_free_extents (osb, et);if (num_free_extents <0 ) { ret = num_free_extents;mlog_errno (ret);
Signature · 1 line
1.5.6.5
PATCH 9/40 ocfs2: ocfs2_find_path() only needs the caching info
In reply to Joel Beckerocfs2_find_path and ocfs2_find_leaf() walk our btrees, reading extent blocks. They need struct ocfs2_caching_info for that, but not struct inode.
--- fs/ocfs2/alloc.c | 73 +++++++++++++++++++++++++----------------------- fs/ocfs2/alloc.h | 5 ++- fs/ocfs2/extent_map.c | 6 +++- fs/ocfs2/xattr.c | 3 +- 4 files changed, 47 insertions(+), 40 deletions(-)
fs/ocfs2/alloc.c +38 -35
@@ -1598,7 +1598,7 @@ typedef void (path_insert_t)(void *, struct buffer_head *);* This code can be called with a cpos larger than the tree, in which * case it will return the rightmost path. */ -static int __ocfs2_find_path (struct inode *inode, +static int __ocfs2_find_path (struct ocfs2_caching_info *ci,struct ocfs2_extent_list *root_el,u32 cpos,path_insert_t *func,void *data) {
@@ -1609,15 +1609,14 @@ static int __ocfs2_find_path(struct inode *inode,struct ocfs2_extent_block *eb;struct ocfs2_extent_list *el;struct ocfs2_extent_rec *rec; -struct ocfs2_inode_info *oi =OCFS2_I (inode); el = root_el;while (el->l_tree_depth) {if (le16_to_cpu (el->l_next_free_rec) ==0 ) { -ocfs2_error (inode->i_sb, -"Inode %llu has empty extent list at " +ocfs2_error (ocfs2_metadata_cache_get_super (ci), +"Owner %llu has empty extent list at " "depth %u\n" , - (unsigned long long )oi->ip_blkno, + (unsigned long long )ocfs2_metadata_cache_owner (ci),le16_to_cpu (el->l_tree_depth)); ret = -EROFS ; goto out;
@@ -1640,10 +1639,10 @@ static int __ocfs2_find_path(struct inode *inode, blkno =le64_to_cpu (el->l_recs[i].e_blkno);if (blkno ==0 ) { -ocfs2_error (inode->i_sb, -"Inode %llu has bad blkno in extent list " +ocfs2_error (ocfs2_metadata_cache_get_super (ci), +"Owner %llu has bad blkno in extent list " "at depth %u (index %d)\n" , - (unsigned long long )oi->ip_blkno, + (unsigned long long )ocfs2_metadata_cache_owner (ci),le16_to_cpu (el->l_tree_depth), i); ret = -EROFS ; goto out;
@@ -1651,7 +1650,7 @@ static int __ocfs2_find_path(struct inode *inode,brelse (bh); bh =NULL ; - ret =ocfs2_read_extent_block (INODE_CACHE (inode), blkno, &bh); + ret =ocfs2_read_extent_block (ci, blkno, &bh);if (ret) {mlog_errno (ret); goto out;
@@ -1662,10 +1661,10 @@ static int __ocfs2_find_path(struct inode *inode,if (le16_to_cpu (el->l_next_free_rec) >le16_to_cpu (el->l_count)) { -ocfs2_error (inode->i_sb, -"Inode %llu has bad count in extent list " +ocfs2_error (ocfs2_metadata_cache_get_super (ci), +"Owner %llu has bad count in extent list " "at block %llu (next free=%u, count=%u)\n" , - (unsigned long long )oi->ip_blkno, + (unsigned long long )ocfs2_metadata_cache_owner (ci), (unsigned long long )bh->b_blocknr,le16_to_cpu (el->l_next_free_rec),le16_to_cpu (el->l_count));
@@ -1709,14 +1708,14 @@ static void find_path_ins(void *data, struct buffer_head *bh)ocfs2_path_insert_eb (fp->path, fp->index, bh); fp->index++; } -static int ocfs2_find_path (struct inode *inode,struct ocfs2_path *path, -u32 cpos) +static int ocfs2_find_path (struct ocfs2_caching_info *ci, +struct ocfs2_path *path,u32 cpos) {struct find_path_data data; data.index =1 ; data.path = path; -return __ocfs2_find_path (inode,path_root_el (path), cpos, +return __ocfs2_find_path (ci,path_root_el (path), cpos, find_path_ins, &data); }
@@ -1741,13 +1740,14 @@ static void find_leaf_ins(void *data, struct buffer_head *bh)* * This function doesn't handle non btree extent lists. */ -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 ocfs2_caching_info *ci, +struct ocfs2_extent_list *root_el,u32 cpos, +struct buffer_head **leaf_bh) {int ret;struct buffer_head *bh =NULL ; - ret =__ocfs2_find_path (inode, root_el, cpos, find_leaf_ins, &bh); + ret =__ocfs2_find_path (ci, root_el, cpos, find_leaf_ins, &bh);if (ret) {mlog_errno (ret); goto out;
@@ -2251,7 +2251,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,mlog (0 ,"Rotating a tree: ins. cpos: %u, left path cpos: %u\n" , insert_cpos, cpos); - ret =ocfs2_find_path (inode, left_path, cpos); + ret =ocfs2_find_path (INODE_CACHE (inode), left_path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -2763,7 +2763,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode, }while (right_cpos) { - ret =ocfs2_find_path (inode, right_path, right_cpos); + ret =ocfs2_find_path (et->et_ci, right_path, right_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -2892,7 +2892,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_find_path (inode, left_path, cpos); + ret =ocfs2_find_path (et->et_ci, left_path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -3132,7 +3132,7 @@ static int ocfs2_get_right_path(struct inode *inode, goto out; } - ret =ocfs2_find_path (inode, right_path, right_cpos); + ret =ocfs2_find_path (INODE_CACHE (inode), right_path, right_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -3301,7 +3301,7 @@ static int ocfs2_get_left_path(struct inode *inode, goto out; } - ret =ocfs2_find_path (inode, left_path, left_cpos); + ret =ocfs2_find_path (INODE_CACHE (inode), left_path, left_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -3831,7 +3831,8 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_find_path (inode, left_path, left_cpos); + ret =ocfs2_find_path (INODE_CACHE (inode), left_path, + left_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -4080,7 +4081,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, cpos =UINT_MAX ; } - ret =ocfs2_find_path (inode, right_path, cpos); + ret =ocfs2_find_path (et->et_ci, right_path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -4177,7 +4178,8 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (!left_path) goto out; - status =ocfs2_find_path (inode, left_path, left_cpos); + status =ocfs2_find_path (INODE_CACHE (inode), + left_path, left_cpos);if (status) goto out;
@@ -4233,7 +4235,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (!right_path) goto out; - status =ocfs2_find_path (inode, right_path, right_cpos); + status =ocfs2_find_path (INODE_CACHE (inode), right_path, right_cpos);if (status) goto out;
@@ -4435,7 +4437,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,* us the rightmost tree path. This is accounted for below in * the appending code. */ - ret =ocfs2_find_path (inode, path,le32_to_cpu (insert_rec->e_cpos)); + ret =ocfs2_find_path (et->et_ci, path,le32_to_cpu (insert_rec->e_cpos));if (ret) {mlog_errno (ret); goto out;
@@ -4785,7 +4787,7 @@ leftright:ocfs2_reinit_path (path,1 ); cpos =le32_to_cpu (split_rec.e_cpos); - ret =ocfs2_find_path (inode, path, cpos); + ret =ocfs2_find_path (et->et_ci, path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -4958,7 +4960,7 @@ int ocfs2_mark_extent_written(struct inode *inode, goto out; } - ret =ocfs2_find_path (inode, left_path, cpos); + ret =ocfs2_find_path (et->et_ci, left_path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -5130,7 +5132,8 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_find_path (inode, left_path, left_cpos); + ret =ocfs2_find_path (et->et_ci, left_path, + left_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -5239,7 +5242,7 @@ int ocfs2_remove_extent(struct inode *inode, goto out; } - ret =ocfs2_find_path (inode, path, cpos); + ret =ocfs2_find_path (et->et_ci, path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -5304,7 +5307,7 @@ int ocfs2_remove_extent(struct inode *inode,*/ ocfs2_reinit_path (path,1 ); - ret =ocfs2_find_path (inode, path, cpos); + ret =ocfs2_find_path (et->et_ci, path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -6332,7 +6335,7 @@ static int ocfs2_find_new_last_ext_blk(struct inode *inode, goto out; } - ret =ocfs2_find_leaf (inode,path_root_el (path), cpos, &bh); + ret =ocfs2_find_leaf (INODE_CACHE (inode),path_root_el (path), cpos, &bh);if (ret) {mlog_errno (ret); goto out;
@@ -7109,7 +7112,7 @@ start:/* * Truncate always works against the rightmost tree branch. */ - status =ocfs2_find_path (inode, path,UINT_MAX ); + status =ocfs2_find_path (INODE_CACHE (inode), path,UINT_MAX );if (status) {mlog_errno (status); goto bail;
fs/ocfs2/alloc.h +3 -2
@@ -220,8 +220,9 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,int ocfs2_truncate_inline (struct inode *inode,struct buffer_head *di_bh,unsigned int start,unsigned int end,int trunc); -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 ocfs2_caching_info *ci, +struct ocfs2_extent_list *root_el,u32 cpos, +struct buffer_head **leaf_bh);int ocfs2_search_extent_list (struct ocfs2_extent_list *el,u32 v_cluster);/*
fs/ocfs2/extent_map.c +4 -2
@@ -428,7 +428,8 @@ static int ocfs2_get_clusters_nocache(struct inode *inode, tree_height =le16_to_cpu (el->l_tree_depth);if (tree_height >0 ) { - ret =ocfs2_find_leaf (inode, el, v_cluster, &eb_bh); + ret =ocfs2_find_leaf (INODE_CACHE (inode), el, v_cluster, + &eb_bh);if (ret) {mlog_errno (ret); goto out;
@@ -548,7 +549,8 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,u32 coff;if (el->l_tree_depth) { - ret =ocfs2_find_leaf (inode, el, v_cluster, &eb_bh); + ret =ocfs2_find_leaf (INODE_CACHE (inode), el, v_cluster, + &eb_bh);if (ret) {mlog_errno (ret); goto out;
fs/ocfs2/xattr.c +2 -1
@@ -2848,7 +2848,8 @@ static int ocfs2_xattr_get_rec(struct inode *inode,u64 e_blkno =0 ;if (el->l_tree_depth) { - ret =ocfs2_find_leaf (inode, el, name_hash, &eb_bh); + ret =ocfs2_find_leaf (INODE_CACHE (inode), el, name_hash, + &eb_bh);if (ret) {mlog_errno (ret); goto out;
Signature · 1 line
1.5.6.5
PATCH 10/40 ocfs2: ocfs2_create_new_meta_bhs() doesn't need struct inode.
In reply to Joel BeckerPass struct ocfs2_extent_tree into ocfs2_create_new_meta_bhs(). It no longer needs struct inode or ocfs2_super.
--- fs/ocfs2/alloc.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-)
fs/ocfs2/alloc.c +9 -8
@@ -850,9 +850,8 @@ bail:* sets h_signature, h_blkno, h_suballoc_bit, h_suballoc_slot, and * l_count for you */ -static int ocfs2_create_new_meta_bhs (struct ocfs2_super *osb, -handle_t *handle, -struct inode *inode, +static int ocfs2_create_new_meta_bhs (handle_t *handle, +struct ocfs2_extent_tree *et,int wanted,struct ocfs2_alloc_context *meta_ac,struct buffer_head *bhs[])
@@ -861,6 +860,8 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,u16 suballoc_bit_start;u32 num_got;u64 first_blkno; +struct ocfs2_super *osb = +OCFS2_SB (ocfs2_metadata_cache_get_super (et->et_ci));struct ocfs2_extent_block *eb;mlog_entry_void ();
@@ -886,10 +887,10 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,mlog_errno (status); goto bail; } -ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), - bhs[i]); +ocfs2_set_new_buffer_uptodate (et->et_ci, bhs[i]); - status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), bhs[i], + status =ocfs2_journal_access_eb (handle, et->et_ci, + bhs[i],OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1008,7 +1009,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, goto bail; } - status =ocfs2_create_new_meta_bhs (osb, handle, inode, new_blocks, + status =ocfs2_create_new_meta_bhs (handle, et, new_blocks, meta_ac, new_eb_bhs);if (status <0 ) {mlog_errno (status);
@@ -1162,7 +1163,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,mlog_entry_void (); - status =ocfs2_create_new_meta_bhs (osb, handle, inode,1 , meta_ac, + status =ocfs2_create_new_meta_bhs (handle, et,1 , meta_ac, &new_eb_bh);if (status <0 ) {mlog_errno (status);
Signature · 1 line
1.5.6.5
PATCH 11/40 ocfs2: Pass ocfs2_extent_tree to ocfs2_unlink_path()
In reply to Joel Beckerocfs2_unlink_path() doesn't need struct inode, so let's pass it struct ocfs2_extent_tree.
--- fs/ocfs2/alloc.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
fs/ocfs2/alloc.c +11 -9
@@ -2381,7 +2381,8 @@ static void ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle, } } -static void ocfs2_unlink_path (struct inode *inode,handle_t *handle, +static void ocfs2_unlink_path (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_cached_dealloc_ctxt *dealloc,struct ocfs2_path *path,int unlink_start) {
@@ -2403,12 +2404,12 @@ static void ocfs2_unlink_path(struct inode *inode, handle_t *handle,mlog (ML_ERROR ,"Inode %llu, attempted to remove extent block " "%llu with %u records\n" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), (unsigned long long )le64_to_cpu (eb->h_blkno),le16_to_cpu (el->l_next_free_rec));ocfs2_journal_dirty (handle, bh); -ocfs2_remove_from_cache (INODE_CACHE (inode), bh); +ocfs2_remove_from_cache (et->et_ci, bh);continue ; }
@@ -2421,11 +2422,12 @@ static void ocfs2_unlink_path(struct inode *inode, handle_t *handle,if (ret)mlog_errno (ret); -ocfs2_remove_from_cache (INODE_CACHE (inode), bh); +ocfs2_remove_from_cache (et->et_ci, bh); } } -static void ocfs2_unlink_subtree(struct inode *inode, handle_t *handle, +static void ocfs2_unlink_subtree(handle_t *handle, + struct ocfs2_extent_tree *et, struct ocfs2_path *left_path, struct ocfs2_path *right_path, int subtree_index,
@@ -2456,7 +2458,7 @@ static void ocfs2_unlink_subtree(struct inode *inode, handle_t *handle,ocfs2_journal_dirty (handle, root_bh);ocfs2_journal_dirty (handle,path_leaf_bh (left_path)); -ocfs2_unlink_path (inode, handle, dealloc, right_path, +ocfs2_unlink_path (handle, et, dealloc, right_path, subtree_index +1 ); }
@@ -2589,7 +2591,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,mlog_errno (ret);if (del_right_subtree) { -ocfs2_unlink_subtree (inode, handle, left_path, right_path, +ocfs2_unlink_subtree (handle, et, left_path, right_path, subtree_index, dealloc);ocfs2_update_edge_lengths (inode, handle, left_path);
@@ -2907,7 +2909,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, subtree_index =ocfs2_find_subtree_root (inode, left_path, path); -ocfs2_unlink_subtree (inode, handle, left_path, path, +ocfs2_unlink_subtree (handle, et, left_path, path, subtree_index, dealloc);ocfs2_update_edge_lengths (inode, handle, left_path);
@@ -2921,7 +2923,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,* revert the inode back to having extents * in-line. */ -ocfs2_unlink_path (inode, handle, dealloc, path,1 ); +ocfs2_unlink_path (handle, et, dealloc, path,1 ); el = et->et_root_el; el->l_tree_depth =0 ;
Signature · 1 line
1.5.6.5
PATCH 12/40 ocfs2: ocfs2_complete_edge_insert() doesn't need struct inode at all.
In reply to Joel BeckerCompletely unused argument. Get rid of it.
--- fs/ocfs2/alloc.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-)
fs/ocfs2/alloc.c +10 -10
@@ -1853,7 +1853,7 @@ static void ocfs2_adjust_root_records(struct ocfs2_extent_list *root_el,* - When we've adjusted the last extent record in the left path leaf and the * 1st extent record in the right path leaf during cross extent block merge. */ -static void ocfs2_complete_edge_insert (struct inode *inode,handle_t *handle, +static void ocfs2_complete_edge_insert (handle_t *handle,struct ocfs2_path *left_path,struct ocfs2_path *right_path,int subtree_index)
@@ -2030,8 +2030,8 @@ static int ocfs2_rotate_subtree_right(struct inode *inode, goto out; } -ocfs2_complete_edge_insert (inode, handle, left_path, right_path, - subtree_index); +ocfs2_complete_edge_insert (handle, left_path, right_path, + subtree_index); out:return ret;
@@ -2612,7 +2612,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, *deleted =1 ; }else -ocfs2_complete_edge_insert (inode, handle, left_path, right_path, +ocfs2_complete_edge_insert (handle, left_path, right_path, subtree_index); out:
@@ -3265,8 +3265,8 @@ static int ocfs2_merge_rec_right(struct inode *inode,if (ret)mlog_errno (ret); -ocfs2_complete_edge_insert (inode, handle, left_path, - right_path, subtree_index); +ocfs2_complete_edge_insert (handle, left_path, right_path, + subtree_index); } out:if (right_path)
@@ -3464,7 +3464,7 @@ static int ocfs2_merge_rec_left(struct inode *inode,ocfs2_mv_path (right_path, left_path); left_path =NULL ; }else -ocfs2_complete_edge_insert (inode, handle, left_path, +ocfs2_complete_edge_insert (handle, left_path, right_path, subtree_index); } out:
@@ -4030,8 +4030,8 @@ static int ocfs2_insert_path(struct inode *inode,*/ subtree_index =ocfs2_find_subtree_root (inode, left_path, right_path); -ocfs2_complete_edge_insert (inode, handle, left_path, - right_path, subtree_index); +ocfs2_complete_edge_insert (handle, left_path, right_path, + subtree_index); } ret =0 ;
@@ -5207,7 +5207,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,int subtree_index; subtree_index =ocfs2_find_subtree_root (inode, left_path, path); -ocfs2_complete_edge_insert (inode, handle, left_path, path, +ocfs2_complete_edge_insert (handle, left_path, path, subtree_index); }
Signature · 1 line
1.5.6.5
PATCH 13/40 ocfs2: Get inode out of ocfs2_rotate_subtree_root_right().
In reply to Joel BeckerPass the ocfs2_extent_list down through ocfs2_rotate_tree_right() and get rid of struct inode in ocfs2_rotate_subtree_root_right().
--- fs/ocfs2/alloc.c | 37 +++++++++++++++++++------------------ 1 files changed, 19 insertions(+), 18 deletions(-)
fs/ocfs2/alloc.c +19 -18
@@ -1931,8 +1931,8 @@ static void ocfs2_complete_edge_insert(handle_t *handle,mlog_errno (ret); } -static int ocfs2_rotate_subtree_right (struct inode *inode, -handle_t *handle, +static int ocfs2_rotate_subtree_right (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *left_path,struct ocfs2_path *right_path,int subtree_index)
@@ -1948,10 +1948,10 @@ static int ocfs2_rotate_subtree_right(struct inode *inode, left_el =path_leaf_el (left_path);if (left_el->l_next_free_rec != left_el->l_count) { -ocfs2_error (inode->i_sb, +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci),"Inode %llu has non-full interior leaf node %llu" "(next free = %u)" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), (unsigned long long )left_leaf_bh->b_blocknr,le16_to_cpu (left_el->l_next_free_rec));return -EROFS ;
@@ -1967,7 +1967,7 @@ static int ocfs2_rotate_subtree_right(struct inode *inode, root_bh = left_path->p_node[subtree_index].bh;BUG_ON (root_bh != right_path->p_node[subtree_index].bh); - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -1975,14 +1975,14 @@ static int ocfs2_rotate_subtree_right(struct inode *inode, }for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, left_path, i);if (ret) {mlog_errno (ret);
@@ -1996,7 +1996,7 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,/* This is a code error, not a disk corruption. */ mlog_bug_on_msg (!right_el->l_next_free_rec,"Inode %llu: Rotate fails " "because rightmost leaf block %llu is empty\n" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), (unsigned long long )right_leaf_bh->b_blocknr);ocfs2_create_empty_extent (right_el);
@@ -2194,8 +2194,8 @@ static int ocfs2_leftmost_rec_contains(struct ocfs2_extent_list *el, u32 cpos)* *ret_left_path will contain a valid path which can be passed to * ocfs2_insert_path(). */ -static int ocfs2_rotate_tree_right(struct inode *inode, - handle_t *handle, +static int ocfs2_rotate_tree_right(struct inode *inode, handle_t *handle, + struct ocfs2_extent_tree *et, enum ocfs2_split_type split, u32 insert_cpos, struct ocfs2_path *right_path,
@@ -2204,6 +2204,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,int ret, start, orig_credits = handle->h_buffer_credits;u32 cpos;struct ocfs2_path *left_path =NULL ; +struct super_block *sb =ocfs2_metadata_cache_get_super (et->et_ci); *ret_left_path =NULL ;
@@ -2214,7 +2215,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode, goto out; } - ret =ocfs2_find_cpos_for_left_leaf (inode->i_sb, right_path, &cpos); + ret =ocfs2_find_cpos_for_left_leaf (sb, right_path, &cpos);if (ret) {mlog_errno (ret); goto out;
@@ -2252,7 +2253,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,mlog (0 ,"Rotating a tree: ins. cpos: %u, left path cpos: %u\n" , insert_cpos, cpos); - ret =ocfs2_find_path (INODE_CACHE (inode), left_path, cpos); + ret =ocfs2_find_path (et->et_ci, left_path, cpos);if (ret) {mlog_errno (ret); goto out;
@@ -2260,10 +2261,11 @@ static int ocfs2_rotate_tree_right(struct inode *inode,mlog_bug_on_msg (path_leaf_bh (left_path) ==path_leaf_bh (right_path), -"Inode %lu: error during insert of %u " +"Owner %llu: error during insert of %u " "(left path cpos %u) results in two identical " "paths ending at %llu\n" , - inode->i_ino, insert_cpos, cpos, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), + insert_cpos, cpos, (unsigned long long )path_leaf_bh (left_path)->b_blocknr);
@@ -2303,7 +2305,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode, goto out; } - ret =ocfs2_rotate_subtree_right (inode, handle, left_path, + ret =ocfs2_rotate_subtree_right (handle, et, left_path, right_path, start);if (ret) {mlog_errno (ret);
@@ -2335,8 +2337,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,*/ ocfs2_mv_path (right_path, left_path); - ret =ocfs2_find_cpos_for_left_leaf (inode->i_sb, right_path, - &cpos); + ret =ocfs2_find_cpos_for_left_leaf (sb, right_path, &cpos);if (ret) {mlog_errno (ret); goto out;
@@ -4103,7 +4104,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,* can wind up skipping both of these two special cases... */ if (rotate) { - ret =ocfs2_rotate_tree_right (inode, handle, type->ins_split, + ret =ocfs2_rotate_tree_right (inode, handle, et, type->ins_split,le32_to_cpu (insert_rec->e_cpos), right_path, &left_path);if (ret) {
Signature · 1 line
1.5.6.5
PATCH 14/40 ocfs2: Pass ocfs2_extent_tree to ocfs2_get_subtree_root()
In reply to Joel BeckerGet rid of the inode argument. Use extent_tree instead. This means a few more functions have to pass an extent_tree around.
--- fs/ocfs2/alloc.c | 52 +++++++++++++++++++++++++++------------------------- 1 files changed, 27 insertions(+), 25 deletions(-)
fs/ocfs2/alloc.c +27 -25
@@ -1561,7 +1561,7 @@ set_and_inc:* * The array index of the subtree root is passed back. */ -static int ocfs2_find_subtree_root (struct inode *inode, +static int ocfs2_find_subtree_root (struct ocfs2_extent_tree *et,struct ocfs2_path *left,struct ocfs2_path *right) {
@@ -1579,10 +1579,10 @@ static int ocfs2_find_subtree_root(struct inode *inode,* The caller didn't pass two adjacent paths. */ mlog_bug_on_msg (i > left->p_tree_depth, -"Inode %lu, left depth %u, right depth %u\n" +"Owner %llu, left depth %u, right depth %u\n" "left leaf blk %llu, right leaf blk %llu\n" , - inode->i_ino, left->p_tree_depth, - right->p_tree_depth, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), + left->p_tree_depth, right->p_tree_depth, (unsigned long long )path_leaf_bh (left)->b_blocknr, (unsigned long long )path_leaf_bh (right)->b_blocknr); } while (left->p_node[i].bh->b_blocknr ==
@@ -2291,7 +2291,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode, handle_t *handle, goto out_ret_path; } - start =ocfs2_find_subtree_root (inode, left_path, right_path); + start =ocfs2_find_subtree_root (et, left_path, right_path); mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n", start,
@@ -2773,7 +2773,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode, goto out; } - subtree_root =ocfs2_find_subtree_root (inode, left_path, + subtree_root =ocfs2_find_subtree_root (et, left_path, right_path); mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n",
@@ -2908,7 +2908,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, goto out; } - subtree_index =ocfs2_find_subtree_root (inode, left_path, path); + subtree_index =ocfs2_find_subtree_root (et, left_path, path);ocfs2_unlink_subtree (handle, et, left_path, path, subtree_index, dealloc);
@@ -3159,6 +3159,7 @@ out:static int ocfs2_merge_rec_right (struct inode *inode,struct ocfs2_path *left_path,handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *split_rec,int index) {
@@ -3198,8 +3199,8 @@ static int ocfs2_merge_rec_right(struct inode *inode,le16_to_cpu (left_rec->e_leaf_clusters) != le32_to_cpu(right_rec->e_cpos)); - subtree_index =ocfs2_find_subtree_root (inode, - left_path, right_path); + subtree_index =ocfs2_find_subtree_root (et, left_path, + right_path); ret = ocfs2_extend_rotate_transaction(handle, subtree_index, handle->h_buffer_credits,
@@ -3212,7 +3213,7 @@ static int ocfs2_merge_rec_right(struct inode *inode, root_bh = left_path->p_node[subtree_index].bh;BUG_ON (root_bh != right_path->p_node[subtree_index].bh); - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -3221,14 +3222,14 @@ static int ocfs2_merge_rec_right(struct inode *inode,for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, left_path, i);if (ret) {mlog_errno (ret);
@@ -3241,7 +3242,7 @@ static int ocfs2_merge_rec_right(struct inode *inode, right_rec = &el->l_recs[index +1 ]; } - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), left_path, + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, left_path,path_num_items (left_path) -1 );if (ret) {mlog_errno (ret);
@@ -3252,7 +3253,8 @@ static int ocfs2_merge_rec_right(struct inode *inode,le32_add_cpu (&right_rec->e_cpos, -split_clusters);le64_add_cpu (&right_rec->e_blkno, - -ocfs2_clusters_to_blocks (inode->i_sb, split_clusters)); + -ocfs2_clusters_to_blocks (ocfs2_metadata_cache_get_super (et->et_ci), + split_clusters));le16_add_cpu (&right_rec->e_leaf_clusters, split_clusters);ocfs2_cleanup_merge (el, index);
@@ -3367,8 +3369,8 @@ static int ocfs2_merge_rec_left(struct inode *inode,le16_to_cpu (left_rec->e_leaf_clusters) != le32_to_cpu(split_rec->e_cpos)); - subtree_index =ocfs2_find_subtree_root (inode, - left_path, right_path); + subtree_index =ocfs2_find_subtree_root (et, left_path, + right_path); ret = ocfs2_extend_rotate_transaction(handle, subtree_index, handle->h_buffer_credits,
@@ -3529,7 +3531,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,* if we do merge_right first and merge_left later. */ ret =ocfs2_merge_rec_right (inode, path, - handle, split_rec, + handle, et, split_rec, split_index);if (ret) {mlog_errno (ret);
@@ -3593,9 +3595,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, goto out; } }else { - ret =ocfs2_merge_rec_right (inode, - path, - handle, split_rec, + ret =ocfs2_merge_rec_right (inode, path, handle, + et, split_rec, split_index);if (ret) {mlog_errno (ret);
@@ -3953,6 +3954,7 @@ static void ocfs2_split_record(struct inode *inode,*/ static int ocfs2_insert_path(struct inode *inode, handle_t *handle, + struct ocfs2_extent_tree *et, struct ocfs2_path *left_path, struct ocfs2_path *right_path, struct ocfs2_extent_rec *insert_rec,
@@ -3978,7 +3980,7 @@ static int ocfs2_insert_path(struct inode *inode, goto out; } - ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, left_path); + ret =ocfs2_journal_access_path (et->et_ci, handle, left_path);if (ret <0 ) {mlog_errno (ret); goto out;
@@ -3989,7 +3991,7 @@ static int ocfs2_insert_path(struct inode *inode,* Pass both paths to the journal. The majority of inserts * will be touching all components anyway. */ - ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, right_path); + ret =ocfs2_journal_access_path (et->et_ci, handle, right_path);if (ret <0 ) {mlog_errno (ret); goto out;
@@ -4029,7 +4031,7 @@ static int ocfs2_insert_path(struct inode *inode,* * XXX: Should we extend the transaction here? */ - subtree_index =ocfs2_find_subtree_root (inode, left_path, + subtree_index =ocfs2_find_subtree_root (et, left_path, right_path);ocfs2_complete_edge_insert (handle, left_path, right_path, subtree_index);
@@ -4132,7 +4134,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, } } - ret =ocfs2_insert_path (inode, handle, left_path, right_path, + ret =ocfs2_insert_path (inode, handle, et, left_path, right_path, insert_rec, type);if (ret) {mlog_errno (ret);
@@ -5207,7 +5209,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,if (left_path) {int subtree_index; - subtree_index =ocfs2_find_subtree_root (inode, left_path, path); + subtree_index =ocfs2_find_subtree_root (et, left_path, path);ocfs2_complete_edge_insert (handle, left_path, path, subtree_index); }
Signature · 1 line
1.5.6.5
PATCH 15/40 ocfs2: Drop struct inode from ocfs2_extent_tree_operations.
In reply to Joel BeckerWe can get to the inode from the caching information. Other parent types don't need it.
--- fs/ocfs2/alloc.c | 86 ++++++++++++++++++++++------------------------------- fs/ocfs2/inode.c | 4 -- fs/ocfs2/inode.h | 6 ++++ 3 files changed, 42 insertions(+), 54 deletions(-)
fs/ocfs2/alloc.c +36 -50
@@ -79,18 +79,16 @@ struct ocfs2_extent_tree_operations {* that value. new_clusters is the delta, and must be * added to the total. Required. */ -void (*eo_update_clusters)(struct inode *inode, -struct ocfs2_extent_tree *et, +void (*eo_update_clusters)(struct ocfs2_extent_tree *et,u32 new_clusters);/* * If ->eo_insert_check() exists, it is called before rec is * inserted into the extent tree. It is optional. */ -int (*eo_insert_check)(struct inode *inode, -struct ocfs2_extent_tree *et, +int (*eo_insert_check)(struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *rec); -int (*eo_sanity_check)(struct inode *inode,struct ocfs2_extent_tree *et); +int (*eo_sanity_check)(struct ocfs2_extent_tree *et);/* * --------------------------------------------------------------
@@ -109,8 +107,7 @@ struct ocfs2_extent_tree_operations {* it exists. If it does not, et->et_max_leaf_clusters is set * to 0 (unlimited). Optional. */ -void (*eo_fill_max_leaf_clusters)(struct inode *inode, -struct ocfs2_extent_tree *et); +void (*eo_fill_max_leaf_clusters)(struct ocfs2_extent_tree *et); };
@@ -121,14 +118,11 @@ struct ocfs2_extent_tree_operations {static u64 ocfs2_dinode_get_last_eb_blk (struct ocfs2_extent_tree *et);static void ocfs2_dinode_set_last_eb_blk (struct ocfs2_extent_tree *et,u64 blkno); -static void ocfs2_dinode_update_clusters (struct inode *inode, -struct ocfs2_extent_tree *et, +static void ocfs2_dinode_update_clusters (struct ocfs2_extent_tree *et,u32 clusters); -static int ocfs2_dinode_insert_check (struct inode *inode, -struct ocfs2_extent_tree *et, +static int ocfs2_dinode_insert_check (struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *rec); -static int ocfs2_dinode_sanity_check (struct inode *inode, -struct ocfs2_extent_tree *et); +static int ocfs2_dinode_sanity_check (struct ocfs2_extent_tree *et);static void ocfs2_dinode_fill_root_el (struct ocfs2_extent_tree *et);static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = { .eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk,
@@ -156,39 +150,37 @@ static u64 ocfs2_dinode_get_last_eb_blk(struct ocfs2_extent_tree *et)return le64_to_cpu (di->i_last_eb_blk); } -static void ocfs2_dinode_update_clusters (struct inode *inode, -struct ocfs2_extent_tree *et, +static void ocfs2_dinode_update_clusters (struct ocfs2_extent_tree *et,u32 clusters) { +struct ocfs2_inode_info *oi =cache_info_to_inode (et->et_ci);struct ocfs2_dinode *di = et->et_object;le32_add_cpu (&di->i_clusters, clusters); -spin_lock (&OCFS2_I (inode)->ip_lock); -OCFS2_I (inode)->ip_clusters =le32_to_cpu (di->i_clusters); -spin_unlock (&OCFS2_I (inode)->ip_lock); +spin_lock (&oi->ip_lock); + oi->ip_clusters =le32_to_cpu (di->i_clusters); +spin_unlock (&oi->ip_lock); } -static int ocfs2_dinode_insert_check (struct inode *inode, -struct ocfs2_extent_tree *et, +static int ocfs2_dinode_insert_check (struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *rec) { -struct ocfs2_super *osb =OCFS2_SB (inode->i_sb); +struct ocfs2_inode_info *oi =cache_info_to_inode (et->et_ci); +struct ocfs2_super *osb =OCFS2_SB (oi->vfs_inode.i_sb); -BUG_ON (OCFS2_I (inode)->ip_dyn_features &OCFS2_INLINE_DATA_FL ); +BUG_ON (oi->ip_dyn_features &OCFS2_INLINE_DATA_FL );mlog_bug_on_msg (!ocfs2_sparse_alloc (osb) && - (OCFS2_I (inode)->ip_clusters != rec->e_cpos), + (oi->ip_clusters != rec->e_cpos),"Device %s, asking for sparse allocation: inode %llu, " "cpos %u, clusters %u\n" , osb->dev_str, - (unsigned long long )OCFS2_I (inode)->ip_blkno, - rec->e_cpos, -OCFS2_I (inode)->ip_clusters); + (unsigned long long )oi->ip_blkno, + rec->e_cpos, oi->ip_clusters);return 0 ; } -static int ocfs2_dinode_sanity_check (struct inode *inode, -struct ocfs2_extent_tree *et) +static int ocfs2_dinode_sanity_check (struct ocfs2_extent_tree *et) {struct ocfs2_dinode *di = et->et_object;
@@ -228,8 +220,7 @@ static u64 ocfs2_xattr_value_get_last_eb_blk(struct ocfs2_extent_tree *et)return le64_to_cpu (vb->vb_xv->xr_last_eb_blk); } -static void ocfs2_xattr_value_update_clusters (struct inode *inode, -struct ocfs2_extent_tree *et, +static void ocfs2_xattr_value_update_clusters (struct ocfs2_extent_tree *et,u32 clusters) {struct ocfs2_xattr_value_buf *vb = et->et_object;
@@ -251,12 +242,11 @@ static void ocfs2_xattr_tree_fill_root_el(struct ocfs2_extent_tree *et) et->et_root_el = &xb->xb_attrs.xb_root.xt_list; } -static void ocfs2_xattr_tree_fill_max_leaf_clusters (struct inode *inode, -struct ocfs2_extent_tree *et) +static void ocfs2_xattr_tree_fill_max_leaf_clusters (struct ocfs2_extent_tree *et) { +struct super_block *sb =ocfs2_metadata_cache_get_super (et->et_ci); et->et_max_leaf_clusters = -ocfs2_clusters_for_bytes (inode->i_sb, -OCFS2_MAX_XATTR_TREE_LEAF_SIZE ); +ocfs2_clusters_for_bytes (sb,OCFS2_MAX_XATTR_TREE_LEAF_SIZE ); } static void ocfs2_xattr_tree_set_last_eb_blk(struct ocfs2_extent_tree *et,
@@ -276,8 +266,7 @@ static u64 ocfs2_xattr_tree_get_last_eb_blk(struct ocfs2_extent_tree *et)return le64_to_cpu (xt->xt_last_eb_blk); } -static void ocfs2_xattr_tree_update_clusters (struct inode *inode, -struct ocfs2_extent_tree *et, +static void ocfs2_xattr_tree_update_clusters (struct ocfs2_extent_tree *et,u32 clusters) {struct ocfs2_xattr_block *xb = et->et_object;
@@ -312,7 +301,7 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,if (!et->et_ops->eo_fill_max_leaf_clusters) et->et_max_leaf_clusters =0 ;else - et->et_ops->eo_fill_max_leaf_clusters (inode, et); + et->et_ops->eo_fill_max_leaf_clusters (et); } void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
@@ -350,11 +339,10 @@ static inline u64 ocfs2_et_get_last_eb_blk(struct ocfs2_extent_tree *et)return et->et_ops->eo_get_last_eb_blk (et); } -static inline void ocfs2_et_update_clusters (struct inode *inode, -struct ocfs2_extent_tree *et, +static inline void ocfs2_et_update_clusters (struct ocfs2_extent_tree *et,u32 clusters) { - et->et_ops->eo_update_clusters (inode, et, clusters); + et->et_ops->eo_update_clusters (et, clusters); } static inline int ocfs2_et_root_journal_access(handle_t *handle,
@@ -365,24 +353,22 @@ static inline int ocfs2_et_root_journal_access(handle_t *handle, type); } -static inline int ocfs2_et_insert_check (struct inode *inode, -struct ocfs2_extent_tree *et, +static inline int ocfs2_et_insert_check (struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *rec) {int ret =0 ;if (et->et_ops->eo_insert_check) - ret = et->et_ops->eo_insert_check (inode, et, rec); + ret = et->et_ops->eo_insert_check (et, rec);return ret; } -static inline int ocfs2_et_sanity_check (struct inode *inode, -struct ocfs2_extent_tree *et) +static inline int ocfs2_et_sanity_check (struct ocfs2_extent_tree *et) {int ret =0 ;if (et->et_ops->eo_sanity_check) - ret = et->et_ops->eo_sanity_check (inode, et); + ret = et->et_ops->eo_sanity_check (et);return ret; }
@@ -2856,7 +2842,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,struct ocfs2_extent_list *el; - ret =ocfs2_et_sanity_check (inode, et); + ret =ocfs2_et_sanity_check (et);if (ret) goto out;/*
@@ -4143,7 +4129,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, out_update_clusters:if (type->ins_split ==SPLIT_NONE ) -ocfs2_et_update_clusters (inode, et, +ocfs2_et_update_clusters (et,le16_to_cpu (insert_rec->e_leaf_clusters)); ret =ocfs2_journal_dirty (handle, et->et_root_bh);
@@ -4532,7 +4518,7 @@ int ocfs2_insert_extent(struct ocfs2_super *osb, rec.e_blkno =cpu_to_le64 (start_blk); rec.e_leaf_clusters =cpu_to_le16 (new_clusters); rec.e_flags = flags; - status =ocfs2_et_insert_check (inode, et, &rec); + status =ocfs2_et_insert_check (et, &rec);if (status) {mlog_errno (status); goto bail;
@@ -5413,7 +5399,7 @@ int ocfs2_remove_btree_range(struct inode *inode, goto out_commit; } -ocfs2_et_update_clusters (inode, et, -len); +ocfs2_et_update_clusters (et, -len); ret =ocfs2_journal_dirty (handle, et->et_root_bh);if (ret) {
fs/ocfs2/inode.c +0 -4
@@ -1347,10 +1347,6 @@ int ocfs2_read_inode_block(struct inode *inode, struct buffer_head **bh)return ocfs2_read_inode_block_full (inode, bh,0 ); } -static struct ocfs2_inode_info *cache_info_to_inode (struct ocfs2_caching_info *ci) -{ - return container_of(ci, struct ocfs2_inode_info, ip_metadata_cache); -}static u64 ocfs2_inode_cache_owner (struct ocfs2_caching_info *ci) {
fs/ocfs2/inode.h +6 -0
@@ -165,4 +165,10 @@ int ocfs2_read_inode_block(struct inode *inode, struct buffer_head **bh);/* The same, but can be passed OCFS2_BH_* flags */ int ocfs2_read_inode_block_full (struct inode *inode,struct buffer_head **bh,int flags); + +static inline struct ocfs2_inode_info *cache_info_to_inode (struct ocfs2_caching_info *ci) +{ + return container_of(ci, struct ocfs2_inode_info, ip_metadata_cache); +} +#endif /* OCFS2_INODE_H */
Signature · 1 line
1.5.6.5
PATCH 16/40 ocfs2: ocfs2_rotate_tree_right() doesn't need struct inode.
In reply to Joel BeckerWe don't need struct inode in ocfs2_rotate_tree_right() anymore.
--- fs/ocfs2/alloc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ocfs2/alloc.c +2 -2
@@ -2180,7 +2180,7 @@ static int ocfs2_leftmost_rec_contains(struct ocfs2_extent_list *el, u32 cpos)* *ret_left_path will contain a valid path which can be passed to * ocfs2_insert_path(). */ -static int ocfs2_rotate_tree_right(struct inode *inode, handle_t *handle, +static int ocfs2_rotate_tree_right(handle_t *handle, struct ocfs2_extent_tree *et, enum ocfs2_split_type split, u32 insert_cpos,
@@ -4092,7 +4092,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,* can wind up skipping both of these two special cases... */ if (rotate) { - ret =ocfs2_rotate_tree_right (inode, handle, et, type->ins_split, + ret =ocfs2_rotate_tree_right (handle, et, type->ins_split,le32_to_cpu (insert_rec->e_cpos), right_path, &left_path);if (ret) {
Signature · 1 line
1.5.6.5
PATCH 17/40 ocfs2: ocfs2_update_edge_lengths() doesn't need struct inode.
In reply to Joel BeckerUnused parameter. Remove it.
--- fs/ocfs2/alloc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
fs/ocfs2/alloc.c +3 -3
@@ -2337,7 +2337,7 @@ out_ret_path:return ret; } -static void ocfs2_update_edge_lengths (struct inode *inode,handle_t *handle, +static void ocfs2_update_edge_lengths (handle_t *handle,struct ocfs2_path *path) {int i, idx;
@@ -2580,7 +2580,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,if (del_right_subtree) {ocfs2_unlink_subtree (handle, et, left_path, right_path, subtree_index, dealloc); -ocfs2_update_edge_lengths (inode, handle, left_path); +ocfs2_update_edge_lengths (handle, left_path); eb = (struct ocfs2_extent_block *)path_leaf_bh (left_path)->b_data;ocfs2_et_set_last_eb_blk (et,le64_to_cpu (eb->h_blkno));
@@ -2898,7 +2898,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,ocfs2_unlink_subtree (handle, et, left_path, path, subtree_index, dealloc); -ocfs2_update_edge_lengths (inode, handle, left_path); +ocfs2_update_edge_lengths (handle, left_path); eb = (struct ocfs2_extent_block *)path_leaf_bh (left_path)->b_data;ocfs2_et_set_last_eb_blk (et,le64_to_cpu (eb->h_blkno));
Signature · 1 line
1.5.6.5
PATCH 18/40 ocfs2: ocfs2_rotate_subtree_left() doesn't need struct inode.
In reply to Joel BeckerIt already has struct ocfs2_extent_tree, which has the caching info. So we don't need to pass it struct inode.
--- fs/ocfs2/alloc.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
fs/ocfs2/alloc.c +9 -9
@@ -2449,13 +2449,13 @@ static void ocfs2_unlink_subtree(handle_t *handle, subtree_index + 1); } -static int ocfs2_rotate_subtree_left (struct inode *inode,handle_t *handle, +static int ocfs2_rotate_subtree_left (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *left_path,struct ocfs2_path *right_path,int subtree_index,struct ocfs2_cached_dealloc_ctxt *dealloc, -int *deleted, -struct ocfs2_extent_tree *et) +int *deleted) {int ret, i, del_right_subtree =0 , right_has_empty =0 ;struct buffer_head *root_bh, *et_root_bh =path_root_bh (right_path);
@@ -2491,7 +2491,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,return -EAGAIN ;if (le16_to_cpu (right_leaf_el->l_next_free_rec) >1 ) { - ret =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), + ret =ocfs2_journal_access_eb (handle, et->et_ci,path_leaf_bh (right_path),OCFS2_JOURNAL_ACCESS_WRITE );if (ret) {
@@ -2526,7 +2526,7 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,*/ BUG_ON (right_has_empty && !del_right_subtree); - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -2534,14 +2534,14 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, }for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, left_path, i);if (ret) {mlog_errno (ret);
@@ -2786,9 +2786,9 @@ static int __ocfs2_rotate_tree_left(struct inode *inode, goto out; } - ret =ocfs2_rotate_subtree_left (inode, handle, left_path, + ret =ocfs2_rotate_subtree_left (handle, et, left_path, right_path, subtree_root, - dealloc, &deleted, et); + dealloc, &deleted);if (ret == -EAGAIN ) {/* * The rotation has to temporarily stop due to
Signature · 1 line
1.5.6.5
PATCH 19/40 ocfs2: __ocfs2_rotate_tree_left() doesn't need struct inode.
In reply to Joel BeckerIt already has struct ocfs2_extent_tree, which has the caching info. So we don't need to pass it struct inode.
--- fs/ocfs2/alloc.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
fs/ocfs2/alloc.c +12 -12
@@ -2713,24 +2713,24 @@ out:return ret; } -static int __ocfs2_rotate_tree_left (struct inode *inode, -handle_t *handle,int orig_credits, +static int __ocfs2_rotate_tree_left (handle_t *handle, +struct ocfs2_extent_tree *et, +int orig_credits,struct ocfs2_path *path,struct ocfs2_cached_dealloc_ctxt *dealloc, -struct ocfs2_path **empty_extent_path, -struct ocfs2_extent_tree *et) +struct ocfs2_path **empty_extent_path) {int ret, subtree_root, deleted;u32 right_cpos;struct ocfs2_path *left_path =NULL ;struct ocfs2_path *right_path =NULL ; +struct super_block *sb =ocfs2_metadata_cache_get_super (et->et_ci);BUG_ON (!ocfs2_is_empty_extent (&(path_leaf_el (path)->l_recs[0 ]))); *empty_extent_path =NULL ; - ret =ocfs2_find_cpos_for_right_leaf (inode->i_sb, path, - &right_cpos); + ret =ocfs2_find_cpos_for_right_leaf (sb, path, &right_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -2779,7 +2779,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,* Caller might still want to make changes to the * tree root, so re-add it to the journal here. */ - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, left_path,0 );if (ret) {mlog_errno (ret);
@@ -2815,7 +2815,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,ocfs2_mv_path (left_path, right_path); - ret =ocfs2_find_cpos_for_right_leaf (inode->i_sb, left_path, + ret =ocfs2_find_cpos_for_right_leaf (sb, left_path, &right_cpos);if (ret) {mlog_errno (ret);
@@ -3024,8 +3024,8 @@ rightmost_no_delete:* and restarting from there. */ try_rotate: - ret =__ocfs2_rotate_tree_left (inode, handle, orig_credits, path, - dealloc, &restart_path, et); + ret =__ocfs2_rotate_tree_left (handle, et, orig_credits, path, + dealloc, &restart_path);if (ret && ret != -EAGAIN ) {mlog_errno (ret); goto out;
@@ -3035,9 +3035,9 @@ try_rotate: tmp_path = restart_path; restart_path =NULL ; - ret =__ocfs2_rotate_tree_left (inode, handle, orig_credits, + ret =__ocfs2_rotate_tree_left (handle, et, orig_credits, tmp_path, dealloc, - &restart_path, et); + &restart_path);if (ret && ret != -EAGAIN ) {mlog_errno (ret); goto out;
Signature · 1 line
1.5.6.5
PATCH 20/40 ocfs2: ocfs2_rotate_tree_left() no longer needs struct inode.
In reply to Joel BeckerIt already gets ocfs2_extent_tree, so we can just use that. This chains to the same modification for ocfs2_remove_rightmost_path() and ocfs2_rotate_rightmost_leaf_left().
--- fs/ocfs2/alloc.c | 56 +++++++++++++++++++++++++---------------------------- 1 files changed, 26 insertions(+), 30 deletions(-)
fs/ocfs2/alloc.c +26 -30
@@ -2685,8 +2685,8 @@ out:return ret; } -static int ocfs2_rotate_rightmost_leaf_left (struct inode *inode, -handle_t *handle, +static int ocfs2_rotate_rightmost_leaf_left (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *path) {int ret;
@@ -2696,7 +2696,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,if (!ocfs2_is_empty_extent (&el->l_recs[0 ]))return 0 ; - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), path, + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, path,path_num_items (path) -1 );if (ret) {mlog_errno (ret);
@@ -2830,10 +2830,10 @@ out:return ret; } -static int ocfs2_remove_rightmost_path (struct inode *inode,handle_t *handle, +static int ocfs2_remove_rightmost_path (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *path, -struct ocfs2_cached_dealloc_ctxt *dealloc, -struct ocfs2_extent_tree *et) +struct ocfs2_cached_dealloc_ctxt *dealloc) {int ret, subtree_index;u32 cpos;
@@ -2907,7 +2907,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,* 'path' is also the leftmost path which * means it must be the only one. This gets * handled differently because we want to -* revert the inode back to having extents +* revert the root back to having extents * in-line. */ ocfs2_unlink_path (handle, et, dealloc, path,1 );
@@ -2943,10 +2943,10 @@ out:* the rightmost tree leaf record is removed so the caller is * responsible for detecting and correcting that. */ -static int ocfs2_rotate_tree_left (struct inode *inode,handle_t *handle, +static int ocfs2_rotate_tree_left (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *path, -struct ocfs2_cached_dealloc_ctxt *dealloc, -struct ocfs2_extent_tree *et) +struct ocfs2_cached_dealloc_ctxt *dealloc) {int ret, orig_credits = handle->h_buffer_credits;struct ocfs2_path *tmp_path =NULL , *restart_path =NULL ;
@@ -2963,8 +2963,7 @@ rightmost_no_delete:* Inline extents. This is trivially handled, so do * it up front. */ - ret =ocfs2_rotate_rightmost_leaf_left (inode, handle, - path); + ret =ocfs2_rotate_rightmost_leaf_left (handle, et, path);if (ret)mlog_errno (ret); goto out;
@@ -2980,7 +2979,7 @@ rightmost_no_delete:* * 1) is handled via ocfs2_rotate_rightmost_leaf_left() * 2a) we need the left branch so that we can update it with the unlink -* 2b) we need to bring the inode back to inline extents. +* 2b) we need to bring the root back to inline extents. */ eb = (struct ocfs2_extent_block *)path_leaf_bh (path)->b_data;
@@ -2996,9 +2995,9 @@ rightmost_no_delete:if (le16_to_cpu (el->l_next_free_rec) ==0 ) { ret = -EIO ; -ocfs2_error (inode->i_sb, -"Inode %llu has empty extent block at %llu" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci), +"Owner %llu has empty extent block at %llu" , + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), (unsigned long long )le64_to_cpu (eb->h_blkno)); goto out; }
@@ -3012,8 +3011,8 @@ rightmost_no_delete:* nonempty list. */ - ret =ocfs2_remove_rightmost_path (inode, handle, path, - dealloc, et); + ret =ocfs2_remove_rightmost_path (handle, et, path, + dealloc);if (ret)mlog_errno (ret); goto out;
@@ -3439,9 +3438,9 @@ static int ocfs2_merge_rec_left(struct inode *inode,if (le16_to_cpu (right_rec->e_leaf_clusters) ==0 &&le16_to_cpu (el->l_next_free_rec) ==1 ) { - ret =ocfs2_remove_rightmost_path (inode, handle, + ret =ocfs2_remove_rightmost_path (handle, et, right_path, - dealloc, et); + dealloc);if (ret) {mlog_errno (ret); goto out;
@@ -3486,8 +3485,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,* extents - having more than one in a leaf is * illegal. */ - ret =ocfs2_rotate_tree_left (inode, handle, path, - dealloc, et); + ret =ocfs2_rotate_tree_left (handle, et, path, dealloc);if (ret) {mlog_errno (ret); goto out;
@@ -3530,8 +3528,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,BUG_ON (!ocfs2_is_empty_extent (&el->l_recs[0 ]));/* The merge left us with an empty extent, remove it. */ - ret =ocfs2_rotate_tree_left (inode, handle, path, - dealloc, et); + ret =ocfs2_rotate_tree_left (handle, et, path, dealloc);if (ret) {mlog_errno (ret); goto out;
@@ -3553,8 +3550,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode, goto out; } - ret =ocfs2_rotate_tree_left (inode, handle, path, - dealloc, et); + ret =ocfs2_rotate_tree_left (handle, et, path, dealloc);/* * Error from this last rotate is not critical, so * print but don't bubble it up.
@@ -3595,8 +3591,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,* The merge may have left an empty extent in * our leaf. Try to rotate it away. */ - ret =ocfs2_rotate_tree_left (inode, handle, path, - dealloc, et); + ret =ocfs2_rotate_tree_left (handle, et, path, + dealloc);if (ret)mlog_errno (ret); ret =0 ;
@@ -5071,7 +5067,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,struct ocfs2_extent_block *eb;if (ocfs2_is_empty_extent (&el->l_recs[0 ]) && index >0 ) { - ret =ocfs2_rotate_tree_left (inode, handle, path, dealloc, et); + ret =ocfs2_rotate_tree_left (handle, et, path, dealloc);if (ret) {mlog_errno (ret); goto out;
@@ -5202,7 +5198,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,ocfs2_journal_dirty (handle,path_leaf_bh (path)); - ret =ocfs2_rotate_tree_left (inode, handle, path, dealloc, et); + ret =ocfs2_rotate_tree_left (handle, et, path, dealloc);if (ret) {mlog_errno (ret); goto out;
Signature · 1 line
1.5.6.5
PATCH 21/40 ocfs2: ocfs2_merge_rec_left/right() no longer need struct inode.
In reply to Joel BeckerDrop it from the parameters - they already have ocfs2_extent_list.
--- fs/ocfs2/alloc.c | 54 ++++++++++++++++++++++++------------------------------ 1 files changed, 24 insertions(+), 30 deletions(-)
fs/ocfs2/alloc.c +24 -30
@@ -3087,7 +3087,7 @@ static void ocfs2_cleanup_merge(struct ocfs2_extent_list *el, } } -static int ocfs2_get_right_path (struct inode *inode, +static int ocfs2_get_right_path (struct ocfs2_extent_tree *et,struct ocfs2_path *left_path,struct ocfs2_path **ret_right_path) {
@@ -3104,8 +3104,8 @@ static int ocfs2_get_right_path(struct inode *inode, left_el =path_leaf_el (left_path);BUG_ON (left_el->l_next_free_rec != left_el->l_count); - ret =ocfs2_find_cpos_for_right_leaf (inode->i_sb, left_path, - &right_cpos); + ret =ocfs2_find_cpos_for_right_leaf (ocfs2_metadata_cache_get_super (et->et_ci), + left_path, &right_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -3121,7 +3121,7 @@ static int ocfs2_get_right_path(struct inode *inode, goto out; } - ret =ocfs2_find_path (INODE_CACHE (inode), right_path, right_cpos); + ret =ocfs2_find_path (et->et_ci, right_path, right_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -3141,8 +3141,7 @@ out:* For index == l_count - 1, the "next" means the 1st extent rec of the * next extent block. */ -static int ocfs2_merge_rec_right(struct inode *inode, - struct ocfs2_path *left_path, +static int ocfs2_merge_rec_right(struct ocfs2_path *left_path, handle_t *handle, struct ocfs2_extent_tree *et, struct ocfs2_extent_rec *split_rec,
@@ -3165,7 +3164,7 @@ static int ocfs2_merge_rec_right(struct inode *inode,if (index ==le16_to_cpu (el->l_next_free_rec) -1 &&le16_to_cpu (el->l_next_free_rec) ==le16_to_cpu (el->l_count)) {/* we meet with a cross extent block merge. */ - ret =ocfs2_get_right_path (inode, left_path, &right_path); + ret =ocfs2_get_right_path (et, left_path, &right_path);if (ret) {mlog_errno (ret); goto out;
@@ -3262,7 +3261,7 @@ out:return ret; } -static int ocfs2_get_left_path (struct inode *inode, +static int ocfs2_get_left_path (struct ocfs2_extent_tree *et,struct ocfs2_path *right_path,struct ocfs2_path **ret_left_path) {
@@ -3275,7 +3274,7 @@ static int ocfs2_get_left_path(struct inode *inode,/* This function shouldn't be called for non-trees. */ BUG_ON (right_path->p_tree_depth ==0 ); - ret =ocfs2_find_cpos_for_left_leaf (inode->i_sb, + ret =ocfs2_find_cpos_for_left_leaf (ocfs2_metadata_cache_get_super (et->et_ci), right_path, &left_cpos);if (ret) {mlog_errno (ret);
@@ -3292,7 +3291,7 @@ static int ocfs2_get_left_path(struct inode *inode, goto out; } - ret =ocfs2_find_path (INODE_CACHE (inode), left_path, left_cpos); + ret =ocfs2_find_path (et->et_ci, left_path, left_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -3315,12 +3314,11 @@ out:* remove the rightmost leaf extent block in the right_path and change * the right path to indicate the new rightmost path. */ -static int ocfs2_merge_rec_left (struct inode *inode, -struct ocfs2_path *right_path, +static int ocfs2_merge_rec_left (struct ocfs2_path *right_path,handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *split_rec,struct ocfs2_cached_dealloc_ctxt *dealloc, -struct ocfs2_extent_tree *et,int index) {int ret, i, subtree_index =0 , has_empty_extent =0 ;
@@ -3338,7 +3336,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, right_rec = &el->l_recs[index];if (index ==0 ) {/* we meet with a cross extent block merge. */ - ret =ocfs2_get_left_path (inode, right_path, &left_path); + ret =ocfs2_get_left_path (et, right_path, &left_path);if (ret) {mlog_errno (ret); goto out;
@@ -3368,7 +3366,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, root_bh = left_path->p_node[subtree_index].bh;BUG_ON (root_bh != right_path->p_node[subtree_index].bh); - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, subtree_index);if (ret) {mlog_errno (ret);
@@ -3377,14 +3375,14 @@ static int ocfs2_merge_rec_left(struct inode *inode,for (i = subtree_index +1 ; i <path_num_items (right_path); i++) { - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path, i);if (ret) {mlog_errno (ret); goto out; } - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, left_path, i);if (ret) {mlog_errno (ret);
@@ -3397,7 +3395,7 @@ static int ocfs2_merge_rec_left(struct inode *inode, has_empty_extent =1 ; } - ret =ocfs2_path_bh_journal_access (handle,INODE_CACHE (inode), right_path, + ret =ocfs2_path_bh_journal_access (handle, et->et_ci, right_path,path_num_items (right_path) -1 );if (ret) {mlog_errno (ret);
@@ -3416,7 +3414,8 @@ static int ocfs2_merge_rec_left(struct inode *inode,le32_add_cpu (&right_rec->e_cpos, split_clusters);le64_add_cpu (&right_rec->e_blkno, -ocfs2_clusters_to_blocks (inode->i_sb, split_clusters)); +ocfs2_clusters_to_blocks (ocfs2_metadata_cache_get_super (et->et_ci), + split_clusters));le16_add_cpu (&right_rec->e_leaf_clusters, -split_clusters);ocfs2_cleanup_merge (el, index);
@@ -3514,8 +3513,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,* prevoius extent block. It is more efficient and easier * if we do merge_right first and merge_left later. */ - ret =ocfs2_merge_rec_right (inode, path, - handle, et, split_rec, + ret =ocfs2_merge_rec_right (path, handle, et, split_rec, split_index);if (ret) {mlog_errno (ret);
@@ -3540,10 +3538,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,* Note that we don't pass split_rec here on purpose - * we've merged it into the rec already. */ - ret =ocfs2_merge_rec_left (inode, path, - handle, rec, - dealloc, et, - split_index); + ret =ocfs2_merge_rec_left (path, handle, et, rec, + dealloc, split_index);if (ret) {mlog_errno (ret);
@@ -3567,17 +3563,15 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,* the record on the left (hence the left merge). */ if (ctxt->c_contig_type ==CONTIG_RIGHT ) { - ret =ocfs2_merge_rec_left (inode, - path, - handle, split_rec, - dealloc, et, + ret =ocfs2_merge_rec_left (path, handle, et, + split_rec, dealloc, split_index);if (ret) {mlog_errno (ret); goto out; } }else { - ret =ocfs2_merge_rec_right (inode, path, handle, + ret =ocfs2_merge_rec_right (path, handle, et, split_rec, split_index);if (ret) {
Signature · 1 line
1.5.6.5
PATCH 22/40 ocfs2: ocfs2_try_to_merge_extent() doesn't need struct inode.
In reply to Joel BeckerIt's not using it, so remove it from the parameter list.
--- fs/ocfs2/alloc.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
fs/ocfs2/alloc.c +5 -7
@@ -3460,15 +3460,13 @@ out:return ret; } -static int ocfs2_try_to_merge_extent (struct inode *inode, -handle_t *handle, +static int ocfs2_try_to_merge_extent (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *path,int split_index,struct ocfs2_extent_rec *split_rec,struct ocfs2_cached_dealloc_ctxt *dealloc, -struct ocfs2_merge_ctxt *ctxt, -struct ocfs2_extent_tree *et) - +struct ocfs2_merge_ctxt *ctxt) {int ret =0 ;struct ocfs2_extent_list *el =path_leaf_el (path);
@@ -4881,9 +4879,9 @@ static int __ocfs2_mark_extent_written(struct inode *inode,if (ret)mlog_errno (ret); }else { - ret =ocfs2_try_to_merge_extent (inode, handle, path, + ret =ocfs2_try_to_merge_extent (handle, et, path, split_index, split_rec, - dealloc, &ctxt, et); + dealloc, &ctxt);if (ret)mlog_errno (ret); }
Signature · 1 line
1.5.6.5
PATCH 23/40 ocfs2: ocfs2_grow_branch() no longer needs struct inode.
In reply to Joel BeckerIt's not really using it other than to pass it to the subfunctions ocfs2_shift_tree_depth(), ocfs2_find_branch_target(), and ocfs2_add_branch(). They're not using it either, so they drop the argument.
--- fs/ocfs2/alloc.c | 40 ++++++++++++++++------------------------ 1 files changed, 16 insertions(+), 24 deletions(-)
fs/ocfs2/alloc.c +16 -24
@@ -945,7 +945,7 @@ static inline u32 ocfs2_sum_rightmost_rec(struct ocfs2_extent_list *el)/* * Add an entire tree branch to our inode. eb_bh is the extent block -* to start at, if we don't want to start the branch at the dinode +* to start at, if we don't want to start the branch at the root * structure. * * last_eb_bh is required as we have to update it's next_leaf pointer
@@ -954,9 +954,7 @@ static inline u32 ocfs2_sum_rightmost_rec(struct ocfs2_extent_list *el)* the new branch will be 'empty' in the sense that every block will * contain a single record with cluster count == 0. */ -static int ocfs2_add_branch(struct ocfs2_super *osb, - handle_t *handle, - struct inode *inode, +static int ocfs2_add_branch(handle_t *handle, struct ocfs2_extent_tree *et, struct buffer_head *eb_bh, struct buffer_head **last_eb_bh,
@@ -1020,7 +1018,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,BUG_ON (!OCFS2_IS_VALID_EXTENT_BLOCK (eb)); eb_el = &eb->h_list; - status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), bh, + status =ocfs2_journal_access_eb (handle, et->et_ci, bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1060,7 +1058,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,* journal_dirty erroring as it won't unless we've aborted the * handle (in which case we would never be here) so reserving * the write with journal_access is all we need to do. */ - status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), *last_eb_bh, + status =ocfs2_journal_access_eb (handle, et->et_ci, *last_eb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1073,7 +1071,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, goto bail; }if (eb_bh) { - status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), eb_bh, + status =ocfs2_journal_access_eb (handle, et->et_ci, eb_bh,OCFS2_JOURNAL_ACCESS_WRITE );if (status <0 ) {mlog_errno (status);
@@ -1133,9 +1131,7 @@ bail:* returns back the new extent block so you can add a branch to it * after this call. */ -static int ocfs2_shift_tree_depth (struct ocfs2_super *osb, -handle_t *handle, -struct inode *inode, +static int ocfs2_shift_tree_depth (handle_t *handle,struct ocfs2_extent_tree *et,struct ocfs2_alloc_context *meta_ac,struct buffer_head **ret_new_eb_bh)
@@ -1163,7 +1159,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, eb_el = &eb->h_list; root_el = et->et_root_el; - status =ocfs2_journal_access_eb (handle,INODE_CACHE (inode), new_eb_bh, + status =ocfs2_journal_access_eb (handle, et->et_ci, new_eb_bh,OCFS2_JOURNAL_ACCESS_CREATE );if (status <0 ) {mlog_errno (status);
@@ -1238,8 +1234,7 @@ bail:* * return status < 0 indicates an error. */ -static int ocfs2_find_branch_target (struct ocfs2_super *osb, -struct ocfs2_extent_tree *et, +static int ocfs2_find_branch_target (struct ocfs2_extent_tree *et,struct buffer_head **target_bh) {int status =0 , i;
@@ -1320,20 +1315,18 @@ bail:* * *last_eb_bh will be updated by ocfs2_add_branch(). */ -static int ocfs2_grow_tree (struct inode *inode,handle_t *handle, -struct ocfs2_extent_tree *et,int *final_depth, -struct buffer_head **last_eb_bh, +static int ocfs2_grow_tree (handle_t *handle,struct ocfs2_extent_tree *et, +int *final_depth,struct buffer_head **last_eb_bh,struct ocfs2_alloc_context *meta_ac) {int ret, shift;struct ocfs2_extent_list *el = et->et_root_el;int depth =le16_to_cpu (el->l_tree_depth); -struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);struct buffer_head *bh =NULL ;BUG_ON (meta_ac ==NULL ); - shift =ocfs2_find_branch_target (osb, et, &bh); + shift =ocfs2_find_branch_target (et, &bh);if (shift <0 ) { ret = shift;mlog_errno (ret);
@@ -1350,8 +1343,7 @@ static int ocfs2_grow_tree(struct inode *inode, handle_t *handle,/* ocfs2_shift_tree_depth will return us a buffer with * the new extent block (so we can pass that to * ocfs2_add_branch). */ - ret =ocfs2_shift_tree_depth (osb, handle, inode, et, - meta_ac, &bh); + ret =ocfs2_shift_tree_depth (handle, et, meta_ac, &bh);if (ret <0 ) {mlog_errno (ret); goto out;
@@ -1377,7 +1369,7 @@ static int ocfs2_grow_tree(struct inode *inode, handle_t *handle,/* call ocfs2_add_branch to add the final part of the tree with * the new data. */ mlog (0 ,"add branch. bh = %p\n" , bh); - ret =ocfs2_add_branch (osb, handle, inode, et, bh, last_eb_bh, + ret =ocfs2_add_branch (handle, et, bh, last_eb_bh, meta_ac);if (ret <0 ) {mlog_errno (ret);
@@ -4526,7 +4518,7 @@ int ocfs2_insert_extent(struct ocfs2_super *osb, free_records, insert.ins_tree_depth);if (insert.ins_contig ==CONTIG_NONE && free_records ==0 ) { - status =ocfs2_grow_tree (inode, handle, et, + status =ocfs2_grow_tree (handle, et, &insert.ins_tree_depth, &last_eb_bh, meta_ac);if (status) {
@@ -4713,7 +4705,7 @@ leftright:if (le16_to_cpu (rightmost_el->l_next_free_rec) ==le16_to_cpu (rightmost_el->l_count)) { - ret =ocfs2_grow_tree (inode, handle, et, + ret =ocfs2_grow_tree (handle, et, &depth, last_eb_bh, meta_ac);if (ret) {mlog_errno (ret);
@@ -5020,7 +5012,7 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et,if (le16_to_cpu (rightmost_el->l_next_free_rec) ==le16_to_cpu (rightmost_el->l_count)) { - ret =ocfs2_grow_tree (inode, handle, et, &depth, &last_eb_bh, + ret =ocfs2_grow_tree (handle, et, &depth, &last_eb_bh, meta_ac);if (ret) {mlog_errno (ret);
Signature · 1 line
1.5.6.5
PATCH 24/40 ocfs2: ocfs2_append_rec_to_path() loses struct inode.
In reply to Joel BeckerIt can be swapped with an ocfs2_extent_tree. The function ocfs2_adjust_rightmost_records() goes along for the ride.
--- fs/ocfs2/alloc.c | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-)
fs/ocfs2/alloc.c +15 -14
@@ -3710,8 +3710,8 @@ rotate:ocfs2_rotate_leaf (el, insert_rec); } -static void ocfs2_adjust_rightmost_records (struct inode *inode, -handle_t *handle, +static void ocfs2_adjust_rightmost_records (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *path,struct ocfs2_extent_rec *insert_rec) {
@@ -3729,9 +3729,9 @@ static void ocfs2_adjust_rightmost_records(struct inode *inode, next_free =le16_to_cpu (el->l_next_free_rec);if (next_free ==0 ) { -ocfs2_error (inode->i_sb, -"Dinode %llu has a bad extent list" , - (unsigned long long )OCFS2_I (inode)->ip_blkno); +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci), +"Owner %llu has a bad extent list" , + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci)); ret = -EIO ;return ; }
@@ -3751,7 +3751,8 @@ static void ocfs2_adjust_rightmost_records(struct inode *inode, } } -static int ocfs2_append_rec_to_path (struct inode *inode,handle_t *handle, +static int ocfs2_append_rec_to_path (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *insert_rec,struct ocfs2_path *right_path,struct ocfs2_path **ret_left_path)
@@ -3779,8 +3780,8 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle, (next_free == 1 && ocfs2_is_empty_extent(&el->l_recs[0]))) {u32 left_cpos; - ret =ocfs2_find_cpos_for_left_leaf (inode->i_sb, right_path, - &left_cpos); + ret =ocfs2_find_cpos_for_left_leaf (ocfs2_metadata_cache_get_super (et->et_ci), + right_path, &left_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -3802,7 +3803,7 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle, goto out; } - ret =ocfs2_find_path (INODE_CACHE (inode), left_path, + ret =ocfs2_find_path (et->et_ci, left_path, left_cpos);if (ret) {mlog_errno (ret);
@@ -3816,13 +3817,13 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle, } } - ret =ocfs2_journal_access_path (INODE_CACHE (inode), handle, right_path); + ret =ocfs2_journal_access_path (et->et_ci, handle, right_path);if (ret) {mlog_errno (ret); goto out; } -ocfs2_adjust_rightmost_records (inode, handle, right_path, insert_rec); +ocfs2_adjust_rightmost_records (handle, et, right_path, insert_rec); *ret_left_path = left_path; ret =0 ;
@@ -4092,7 +4093,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, } }else if (type->ins_appending ==APPEND_TAIL && type->ins_contig !=CONTIG_LEFT ) { - ret =ocfs2_append_rec_to_path (inode, handle, insert_rec, + ret =ocfs2_append_rec_to_path (handle, et, insert_rec, right_path, &left_path);if (ret) {mlog_errno (ret);
@@ -5150,7 +5151,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,* be deleted by the rotate code. */ rec = &el->l_recs[next_free -1 ]; -ocfs2_adjust_rightmost_records (inode, handle, path, +ocfs2_adjust_rightmost_records (handle, et, path, rec); } }else if (le32_to_cpu (rec->e_cpos) == cpos) {
@@ -5162,7 +5163,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,/* Remove rightmost portion of the record */ le16_add_cpu (&rec->e_leaf_clusters, -len);if (is_rightmost_tree_rec) -ocfs2_adjust_rightmost_records (inode, handle, path, rec); +ocfs2_adjust_rightmost_records (handle, et, path, rec); }else {/* Caller should have trapped this. */ mlog(ML_ERROR, "Inode %llu: Invalid record truncate: (%u, %u) "
Signature · 1 line
1.5.6.5
PATCH 25/40 ocfs2: ocfs2_truncate_rec() doesn't need struct inode.
In reply to Joel BeckerIt's not using it anymore. Remove it from the parameter list.
--- fs/ocfs2/alloc.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
fs/ocfs2/alloc.c +13 -13
@@ -5036,16 +5036,16 @@ out:return ret; } -static int ocfs2_truncate_rec (struct inode *inode,handle_t *handle, +static int ocfs2_truncate_rec (handle_t *handle, +struct ocfs2_extent_tree *et,struct ocfs2_path *path,int index,struct ocfs2_cached_dealloc_ctxt *dealloc, -u32 cpos,u32 len, -struct ocfs2_extent_tree *et) +u32 cpos,u32 len) {int ret;u32 left_cpos, rec_range, trunc_range;int wants_rotate =0 , is_rightmost_tree_rec =0 ; -struct super_block *sb = inode->i_sb; +struct super_block *sb =ocfs2_metadata_cache_get_super (et->et_ci);struct ocfs2_path *left_path =NULL ;struct ocfs2_extent_list *el =path_leaf_el (path);struct ocfs2_extent_rec *rec;
@@ -5084,14 +5084,13 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,* by this leaf and the one to it's left. * * There are two cases we can skip: -* 1) Path is the leftmost one in our inode tree. +* 1) Path is the leftmost one in our btree. * 2) The leaf is rightmost and will be empty after * we remove the extent record - the rotate code * knows how to update the newly formed edge. */ - ret =ocfs2_find_cpos_for_left_leaf (inode->i_sb, path, - &left_cpos); + ret =ocfs2_find_cpos_for_left_leaf (sb, path, &left_cpos);if (ret) {mlog_errno (ret); goto out;
@@ -5166,8 +5165,9 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,ocfs2_adjust_rightmost_records (handle, et, path, rec); }else {/* Caller should have trapped this. */ -mlog (ML_ERROR ,"Inode %llu: Invalid record truncate: (%u, %u) " -"(%u, %u)\n" , (unsigned long long )OCFS2_I (inode)->ip_blkno, +mlog (ML_ERROR ,"Owner %llu: Invalid record truncate: (%u, %u) " +"(%u, %u)\n" , + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci),le32_to_cpu (rec->e_cpos),le16_to_cpu (rec->e_leaf_clusters), cpos, len);BUG ();
@@ -5260,8 +5260,8 @@ int ocfs2_remove_extent(struct inode *inode, le32_to_cpu(rec->e_cpos), ocfs2_rec_clusters(el, rec));if (le32_to_cpu (rec->e_cpos) == cpos || rec_range == trunc_range) { - ret =ocfs2_truncate_rec (inode, handle, path, index, dealloc, - cpos, len, et); + ret =ocfs2_truncate_rec (handle, et, path, index, dealloc, + cpos, len);if (ret) {mlog_errno (ret); goto out;
@@ -5315,8 +5315,8 @@ int ocfs2_remove_extent(struct inode *inode, goto out; } - ret =ocfs2_truncate_rec (inode, handle, path, index, dealloc, - cpos, len, et); + ret =ocfs2_truncate_rec (handle, et, path, index, dealloc, + cpos, len);if (ret) {mlog_errno (ret); goto out;
Signature · 1 line
1.5.6.5
PATCH 26/40 ocfs2: Make truncating the extent map an extent_tree_operation.
In reply to Joel Beckerocfs2_remove_extent() wants to truncate the extent map if it's truncating an inode data extent. But since many btrees can call that function, let's make it an op on ocfs2_extent_tree. Other tree types can leave it empty.
--- fs/ocfs2/alloc.c | 37 +++++++++++++++++++++++++++++++------ 1 files changed, 31 insertions(+), 6 deletions(-)
fs/ocfs2/alloc.c +31 -6
@@ -83,6 +83,13 @@ struct ocfs2_extent_tree_operations { u32 new_clusters);/* +* If this extent tree is supported by an extent map, truncate the +* map to clusters, +*/ +void (*eo_extent_map_truncate)(struct ocfs2_extent_tree *et, +u32 clusters); + +/* * If ->eo_insert_check() exists, it is called before rec is * inserted into the extent tree. It is optional. */
@@ -120,6 +127,8 @@ static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et, u64 blkno);static void ocfs2_dinode_update_clusters (struct ocfs2_extent_tree *et,u32 clusters); +static void ocfs2_dinode_extent_map_truncate (struct ocfs2_extent_tree *et, +u32 clusters);static int ocfs2_dinode_insert_check (struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *rec);static int ocfs2_dinode_sanity_check (struct ocfs2_extent_tree *et);
@@ -128,6 +137,7 @@ static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = { .eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk, .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, .eo_update_clusters = ocfs2_dinode_update_clusters, + .eo_extent_map_truncate = ocfs2_dinode_extent_map_truncate, .eo_insert_check = ocfs2_dinode_insert_check, .eo_sanity_check = ocfs2_dinode_sanity_check, .eo_fill_root_el = ocfs2_dinode_fill_root_el,
@@ -162,6 +172,14 @@ static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et,spin_unlock (&oi->ip_lock); } +static void ocfs2_dinode_extent_map_truncate (struct ocfs2_extent_tree *et, +u32 clusters) +{ +struct inode *inode = &cache_info_to_inode (et->et_ci)->vfs_inode; + +ocfs2_extent_map_trunc (inode, clusters); +} +static int ocfs2_dinode_insert_check (struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *rec) {
@@ -345,6 +363,13 @@ static inline void ocfs2_et_update_clusters(struct ocfs2_extent_tree *et, et->et_ops->eo_update_clusters (et, clusters); } +static inline void ocfs2_et_extent_map_truncate (struct ocfs2_extent_tree *et, +u32 clusters) +{ +if (et->et_ops->eo_extent_map_truncate) + et->et_ops->eo_extent_map_truncate (et, clusters); +} +static inline int ocfs2_et_root_journal_access (handle_t *handle,struct ocfs2_extent_tree *et,int type)
@@ -4919,12 +4944,8 @@ int ocfs2_mark_extent_written(struct inode *inode,/* * XXX: This should be fixed up so that we just re-insert the * next extent records. -* -* XXX: This is a hack on the extent tree, maybe it should be -* an op? */ -if (et->et_ops == &ocfs2_dinode_et_ops) -ocfs2_extent_map_trunc (inode,0 ); +ocfs2_et_extent_map_truncate (et,0 ); left_path =ocfs2_new_path_from_et (et);if (!left_path) {
@@ -5206,7 +5227,11 @@ int ocfs2_remove_extent(struct inode *inode,struct ocfs2_extent_list *el;struct ocfs2_path *path =NULL ; -ocfs2_extent_map_trunc (inode,0 ); +/* +* XXX: Why are we truncating to 0 instead of wherever this +* affects us? +*/ +ocfs2_et_extent_map_truncate (et,0 ); path =ocfs2_new_path_from_et (et);if (!path) {
Signature · 1 line
1.5.6.5
PATCH 27/40 ocfs2: ocfs2_insert_at_leaf() doesn't need struct inode.
In reply to Joel BeckerGive it an ocfs2_extent_tree and it is happy.
--- fs/ocfs2/alloc.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
fs/ocfs2/alloc.c +10 -9
@@ -3647,10 +3647,10 @@ static void ocfs2_subtract_from_rec(struct super_block *sb,* list. If this leaf is part of an allocation tree, it is assumed * that the tree above has been prepared. */ -static void ocfs2_insert_at_leaf (struct ocfs2_extent_rec *insert_rec, +static void ocfs2_insert_at_leaf (struct ocfs2_extent_tree *et, +struct ocfs2_extent_rec *insert_rec,struct ocfs2_extent_list *el, -struct ocfs2_insert_type *insert, -struct inode *inode) +struct ocfs2_insert_type *insert) {int i = insert->ins_contig_index;unsigned int range;
@@ -3662,7 +3662,8 @@ static void ocfs2_insert_at_leaf(struct ocfs2_extent_rec *insert_rec, i =ocfs2_search_extent_list (el,le32_to_cpu (insert_rec->e_cpos));BUG_ON (i ==-1 ); rec = &el->l_recs[i]; -ocfs2_subtract_from_rec (inode->i_sb, insert->ins_split, rec, +ocfs2_subtract_from_rec (ocfs2_metadata_cache_get_super (et->et_ci), + insert->ins_split, rec, insert_rec); goto rotate; }
@@ -3704,10 +3705,10 @@ static void ocfs2_insert_at_leaf(struct ocfs2_extent_rec *insert_rec, mlog_bug_on_msg(le16_to_cpu(el->l_next_free_rec) >= le16_to_cpu(el->l_count), - "inode %lu, depth %u, count %u, next free %u, " + "owner %llu, depth %u, count %u, next free %u, " "rec.cpos %u, rec.clusters %u, " "insert.cpos %u, insert.clusters %u\n", - inode->i_ino, + ocfs2_metadata_cache_owner(et->et_ci), le16_to_cpu(el->l_tree_depth), le16_to_cpu(el->l_count), le16_to_cpu(el->l_next_free_rec),
@@ -4009,8 +4010,8 @@ static int ocfs2_insert_path(struct inode *inode,if (ret)mlog_errno (ret); }else -ocfs2_insert_at_leaf (insert_rec,path_leaf_el (right_path), - insert, inode); +ocfs2_insert_at_leaf (et, insert_rec,path_leaf_el (right_path), + insert); ret =ocfs2_journal_dirty (handle, leaf_bh);if (ret)
@@ -4056,7 +4057,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, }if (le16_to_cpu (el->l_tree_depth) ==0 ) { -ocfs2_insert_at_leaf (insert_rec, el, type, inode); +ocfs2_insert_at_leaf (et, insert_rec, el, type); goto out_update_clusters; }
Signature · 1 line
1.5.6.5
PATCH 28/40 ocfs2: Give ocfs2_split_record() an extent_tree instead of an inode.
In reply to Joel BeckerAnother on the way to generic btree functions.
--- fs/ocfs2/alloc.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
fs/ocfs2/alloc.c +4 -3
@@ -3860,7 +3860,7 @@ out:return ret; } -static void ocfs2_split_record(struct inode *inode, +static void ocfs2_split_record(struct ocfs2_extent_tree *et, struct ocfs2_path *left_path, struct ocfs2_path *right_path, struct ocfs2_extent_rec *split_rec,
@@ -3933,7 +3933,8 @@ static void ocfs2_split_record(struct inode *inode, } rec = &el->l_recs[index]; -ocfs2_subtract_from_rec (inode->i_sb, split, rec, split_rec); +ocfs2_subtract_from_rec (ocfs2_metadata_cache_get_super (et->et_ci), + split, rec, split_rec);ocfs2_rotate_leaf (insert_el, split_rec); }
@@ -3996,7 +3997,7 @@ static int ocfs2_insert_path(struct inode *inode,* of splits, but it's easier to just let one separate * function sort it all out. */ -ocfs2_split_record (inode, left_path, right_path, +ocfs2_split_record (et, left_path, right_path, insert_rec, insert->ins_split);/*
Signature · 1 line
1.5.6.5
PATCH 29/40 ocfs2: ocfs2_do_insert_extent() and ocfs2_insert_path() no longer need an inode.
In reply to Joel BeckerThey aren't using it, so remove it from their parameter lists.
--- fs/ocfs2/alloc.c | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-)
fs/ocfs2/alloc.c +6 -8
@@ -3946,8 +3946,7 @@ static void ocfs2_split_record(struct ocfs2_extent_tree *et,* in. left_path should only be passed in if we need to update that * portion of the tree after an edge insert. */ -static int ocfs2_insert_path(struct inode *inode, - handle_t *handle, +static int ocfs2_insert_path(handle_t *handle, struct ocfs2_extent_tree *et, struct ocfs2_path *left_path, struct ocfs2_path *right_path,
@@ -4036,8 +4035,7 @@ out:return ret; } -static int ocfs2_do_insert_extent (struct inode *inode, -handle_t *handle, +static int ocfs2_do_insert_extent (handle_t *handle,struct ocfs2_extent_tree *et,struct ocfs2_extent_rec *insert_rec,struct ocfs2_insert_type *type)
@@ -4128,7 +4126,7 @@ static int ocfs2_do_insert_extent(struct inode *inode, } } - ret =ocfs2_insert_path (inode, handle, et, left_path, right_path, + ret =ocfs2_insert_path (handle, et, left_path, right_path, insert_rec, type);if (ret) {mlog_errno (ret);
@@ -4556,7 +4554,7 @@ int ocfs2_insert_extent(struct ocfs2_super *osb, }/* Finally, we can add clusters. This might rotate the tree for us. */ - status =ocfs2_do_insert_extent (inode, handle, et, &rec, &insert); + status =ocfs2_do_insert_extent (handle, et, &rec, &insert);if (status <0 )mlog_errno (status);else if (et->et_ops == &ocfs2_dinode_et_ops)
@@ -4771,7 +4769,7 @@ leftright: do_leftright =1 ; } - ret =ocfs2_do_insert_extent (inode, handle, et, &split_rec, &insert); + ret =ocfs2_do_insert_extent (handle, et, &split_rec, &insert);if (ret) {mlog_errno (ret); goto out;
@@ -5050,7 +5048,7 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, insert.ins_split =SPLIT_RIGHT ; insert.ins_tree_depth = depth; - ret =ocfs2_do_insert_extent (inode, handle, et, &split_rec, &insert); + ret =ocfs2_do_insert_extent (handle, et, &split_rec, &insert);if (ret)mlog_errno (ret);
Signature · 1 line
1.5.6.5
PATCH 30/40 ocfs2: ocfs2_extent_contig() only requires the superblock.
In reply to Joel BeckerDon't pass the inode in. We don't want it around for generic btree operations.
--- fs/ocfs2/alloc.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
fs/ocfs2/alloc.c +6 -6
@@ -686,7 +686,7 @@ static int ocfs2_extents_adjacent(struct ocfs2_extent_rec *left, }static enum ocfs2_contig_type -ocfs2_extent_contig (struct inode *inode, +ocfs2_extent_contig (struct super_block *sb,struct ocfs2_extent_rec *ext,struct ocfs2_extent_rec *insert_rec) {
@@ -701,12 +701,12 @@ static enum ocfs2_contig_typereturn CONTIG_NONE ;if (ocfs2_extents_adjacent (ext, insert_rec) && -ocfs2_block_extent_contig (inode->i_sb, ext, blkno)) +ocfs2_block_extent_contig (sb, ext, blkno))return CONTIG_RIGHT ; blkno =le64_to_cpu (ext->e_blkno);if (ocfs2_extents_adjacent (insert_rec, ext) && -ocfs2_block_extent_contig (inode->i_sb, insert_rec, blkno)) +ocfs2_block_extent_contig (sb, insert_rec, blkno))return CONTIG_LEFT ;return CONTIG_NONE ;
@@ -4212,7 +4212,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (split_rec->e_cpos == el->l_recs[index].e_cpos) ret =CONTIG_RIGHT ; }else { - ret =ocfs2_extent_contig (inode, rec, split_rec); + ret =ocfs2_extent_contig (inode->i_sb, rec, split_rec); } }
@@ -4258,7 +4258,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (rec) {enum ocfs2_contig_type contig_type; - contig_type =ocfs2_extent_contig (inode, rec, split_rec); + contig_type =ocfs2_extent_contig (inode->i_sb, rec, split_rec);if (contig_type ==CONTIG_LEFT && ret ==CONTIG_RIGHT ) ret =CONTIG_LEFTRIGHT ;
@@ -4287,7 +4287,7 @@ static void ocfs2_figure_contig_type(struct inode *inode,BUG_ON (le16_to_cpu (el->l_tree_depth) !=0 );for (i =0 ; i <le16_to_cpu (el->l_next_free_rec); i++) { - contig_type =ocfs2_extent_contig (inode, &el->l_recs[i], + contig_type =ocfs2_extent_contig (inode->i_sb, &el->l_recs[i], insert_rec);if (contig_type !=CONTIG_NONE ) { insert->ins_contig_index = i;
Signature · 1 line
1.5.6.5
PATCH 31/40 ocfs2: Swap inode for extent_tree in ocfs2_figure_merge_contig_type().
In reply to Joel BeckerWe don't want struct inode in generic btree operations.
--- fs/ocfs2/alloc.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
fs/ocfs2/alloc.c +13 -13
@@ -4150,7 +4150,8 @@ out: }static enum ocfs2_contig_type -ocfs2_figure_merge_contig_type (struct inode *inode,struct ocfs2_path *path, +ocfs2_figure_merge_contig_type (struct ocfs2_extent_tree *et, +struct ocfs2_path *path,struct ocfs2_extent_list *el,int index,struct ocfs2_extent_rec *split_rec) {
@@ -4162,12 +4163,12 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,struct ocfs2_path *left_path =NULL , *right_path =NULL ;struct buffer_head *bh;struct ocfs2_extent_block *eb; +struct super_block *sb =ocfs2_metadata_cache_get_super (et->et_ci);if (index >0 ) { rec = &el->l_recs[index -1 ]; }else if (path->p_tree_depth >0 ) { - status =ocfs2_find_cpos_for_left_leaf (inode->i_sb, - path, &left_cpos); + status =ocfs2_find_cpos_for_left_leaf (sb, path, &left_cpos);if (status) goto out;
@@ -4176,8 +4177,8 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (!left_path) goto out; - status =ocfs2_find_path (INODE_CACHE (inode), - left_path, left_cpos); + status =ocfs2_find_path (et->et_ci, left_path, + left_cpos);if (status) goto out;
@@ -4187,7 +4188,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path, le16_to_cpu(new_el->l_count)) { bh =path_leaf_bh (left_path); eb = (struct ocfs2_extent_block *)bh->b_data; -ocfs2_error (inode->i_sb, +ocfs2_error (sb,"Extent block #%llu has an " "invalid l_next_free_rec of " "%d. It should have "
@@ -4212,7 +4213,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (split_rec->e_cpos == el->l_recs[index].e_cpos) ret =CONTIG_RIGHT ; }else { - ret =ocfs2_extent_contig (inode->i_sb, rec, split_rec); + ret =ocfs2_extent_contig (sb, rec, split_rec); } }
@@ -4221,8 +4222,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path, rec = &el->l_recs[index +1 ]; else if (le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count) && path->p_tree_depth > 0) { - status =ocfs2_find_cpos_for_right_leaf (inode->i_sb, - path, &right_cpos); + status =ocfs2_find_cpos_for_right_leaf (sb, path, &right_cpos);if (status) goto out;
@@ -4233,7 +4233,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (!right_path) goto out; - status =ocfs2_find_path (INODE_CACHE (inode), right_path, right_cpos); + status =ocfs2_find_path (et->et_ci, right_path, right_cpos);if (status) goto out;
@@ -4243,7 +4243,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (le16_to_cpu (new_el->l_next_free_rec) <=1 ) { bh =path_leaf_bh (right_path); eb = (struct ocfs2_extent_block *)bh->b_data; - ocfs2_error(inode->i_sb, + ocfs2_error(sb, "Extent block #%llu has an " "invalid l_next_free_rec of %d", (unsigned long long)le64_to_cpu(eb->h_blkno),
@@ -4258,7 +4258,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,if (rec) {enum ocfs2_contig_type contig_type; - contig_type =ocfs2_extent_contig (inode->i_sb, rec, split_rec); + contig_type =ocfs2_extent_contig (sb, rec, split_rec);if (contig_type ==CONTIG_LEFT && ret ==CONTIG_RIGHT ) ret =CONTIG_LEFTRIGHT ;
@@ -4850,7 +4850,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode, goto out; } - ctxt.c_contig_type =ocfs2_figure_merge_contig_type (inode, path, el, + ctxt.c_contig_type =ocfs2_figure_merge_contig_type (et, path, el, split_index, split_rec);
Signature · 1 line
1.5.6.5
PATCH 32/40 ocfs2: Remove inode from ocfs2_figure_extent_contig().
In reply to Joel BeckerIt already has an ocfs2_extent_tree and doesn't need the inode.
--- fs/ocfs2/alloc.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-)
fs/ocfs2/alloc.c +6 -7
@@ -4275,11 +4275,10 @@ out:return ret; } -static void ocfs2_figure_contig_type (struct inode *inode, +static void ocfs2_figure_contig_type (struct ocfs2_extent_tree *et,struct ocfs2_insert_type *insert,struct ocfs2_extent_list *el, -struct ocfs2_extent_rec *insert_rec, -struct ocfs2_extent_tree *et) +struct ocfs2_extent_rec *insert_rec) {int i;enum ocfs2_contig_type contig_type =CONTIG_NONE ;
@@ -4287,8 +4286,8 @@ static void ocfs2_figure_contig_type(struct inode *inode,BUG_ON (le16_to_cpu (el->l_tree_depth) !=0 );for (i =0 ; i <le16_to_cpu (el->l_next_free_rec); i++) { - contig_type =ocfs2_extent_contig (inode->i_sb, &el->l_recs[i], - insert_rec); + contig_type =ocfs2_extent_contig (ocfs2_metadata_cache_get_super (et->et_ci), + &el->l_recs[i], insert_rec);if (contig_type !=CONTIG_NONE ) { insert->ins_contig_index = i;break ;
@@ -4417,7 +4416,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,le16_to_cpu (el->l_next_free_rec);if (!insert->ins_tree_depth) { -ocfs2_figure_contig_type (inode, insert, el, insert_rec, et); +ocfs2_figure_contig_type (et, insert, el, insert_rec);ocfs2_figure_appending_type (insert, el, insert_rec);return 0 ; }
@@ -4451,7 +4450,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,* into two types of appends: simple record append, or a * rotate inside the tail leaf. */ -ocfs2_figure_contig_type (inode, insert, el, insert_rec, et); +ocfs2_figure_contig_type (et, insert, el, insert_rec);/* * The insert code isn't quite ready to deal with all cases of
Signature · 1 line
1.5.6.5
PATCH 33/40 ocfs2: ocfs2_figure_insert_type() no longer needs struct inode.
In reply to Joel BeckerIt's not using it, so remove it from the parameter list.
--- fs/ocfs2/alloc.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
fs/ocfs2/alloc.c +2 -3
@@ -4368,8 +4368,7 @@ set_tail_append:* All of the information is stored on the ocfs2_insert_type * structure. */ -static int ocfs2_figure_insert_type(struct inode *inode, - struct ocfs2_extent_tree *et, +static int ocfs2_figure_insert_type(struct ocfs2_extent_tree *et, struct buffer_head **last_eb_bh, struct ocfs2_extent_rec *insert_rec, int *free_records,
@@ -4529,7 +4528,7 @@ int ocfs2_insert_extent(struct ocfs2_super *osb, goto bail; } - status =ocfs2_figure_insert_type (inode, et, &last_eb_bh, &rec, + status =ocfs2_figure_insert_type (et, &last_eb_bh, &rec, &free_records, &insert);if (status <0 ) {mlog_errno (status);
Signature · 1 line
1.5.6.5
PATCH 34/40 ocfs2: Make extent map insertion an extent_tree_operation.
In reply to Joel Beckerocfs2_insert_extent() wants to insert a record into the extent map if it's an inode data extent. But since many btrees can call that function, let's make it an op on ocfs2_extent_tree. Other tree types can leave it empty.
--- fs/ocfs2/alloc.c | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-)
fs/ocfs2/alloc.c +27 -2
@@ -83,6 +83,13 @@ struct ocfs2_extent_tree_operations { u32 new_clusters);/* +* If this extent tree is supported by an extent map, insert +* a record into the map. +*/ +void (*eo_extent_map_insert)(struct ocfs2_extent_tree *et, +struct ocfs2_extent_rec *rec); + +/* * If this extent tree is supported by an extent map, truncate the * map to clusters, */
@@ -127,6 +134,8 @@ static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et, u64 blkno);static void ocfs2_dinode_update_clusters (struct ocfs2_extent_tree *et,u32 clusters); +static void ocfs2_dinode_extent_map_insert (struct ocfs2_extent_tree *et, +struct ocfs2_extent_rec *rec);static void ocfs2_dinode_extent_map_truncate (struct ocfs2_extent_tree *et,u32 clusters); static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et,
@@ -137,6 +146,7 @@ static struct ocfs2_extent_tree_operations ocfs2_dinode_et_ops = { .eo_set_last_eb_blk = ocfs2_dinode_set_last_eb_blk, .eo_get_last_eb_blk = ocfs2_dinode_get_last_eb_blk, .eo_update_clusters = ocfs2_dinode_update_clusters, + .eo_extent_map_insert = ocfs2_dinode_extent_map_insert, .eo_extent_map_truncate = ocfs2_dinode_extent_map_truncate, .eo_insert_check = ocfs2_dinode_insert_check, .eo_sanity_check = ocfs2_dinode_sanity_check,
@@ -172,6 +182,14 @@ static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et,spin_unlock (&oi->ip_lock); } +static void ocfs2_dinode_extent_map_insert (struct ocfs2_extent_tree *et, +struct ocfs2_extent_rec *rec) +{ +struct inode *inode = &cache_info_to_inode (et->et_ci)->vfs_inode; + +ocfs2_extent_map_insert_rec (inode, rec); +} +static void ocfs2_dinode_extent_map_truncate (struct ocfs2_extent_tree *et,u32 clusters) {
@@ -363,6 +381,13 @@ static inline void ocfs2_et_update_clusters(struct ocfs2_extent_tree *et, et->et_ops->eo_update_clusters (et, clusters); } +static inline void ocfs2_et_extent_map_insert (struct ocfs2_extent_tree *et, +struct ocfs2_extent_rec *rec) +{ +if (et->et_ops->eo_extent_map_insert) + et->et_ops->eo_extent_map_insert (et, rec); +} +static inline void ocfs2_et_extent_map_truncate (struct ocfs2_extent_tree *et,u32 clusters) {
@@ -4555,8 +4580,8 @@ int ocfs2_insert_extent(struct ocfs2_super *osb, status =ocfs2_do_insert_extent (handle, et, &rec, &insert);if (status <0 )mlog_errno (status); -else if (et->et_ops == &ocfs2_dinode_et_ops) -ocfs2_extent_map_insert_rec (inode, &rec); +else +ocfs2_et_extent_map_insert (et, &rec); bail:brelse (last_eb_bh);
Signature · 1 line
1.5.6.5
PATCH 35/40 ocfs2: ocfs2_insert_extent() no longer needs struct inode.
In reply to Joel BeckerOne more function down, no inode in the entire insert-extent chain.
--- fs/ocfs2/alloc.c | 19 ++++++++----------- fs/ocfs2/alloc.h | 4 +--- fs/ocfs2/dir.c | 4 ++-- fs/ocfs2/xattr.c | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-)
fs/ocfs2/alloc.c +8 -11
@@ -4519,13 +4519,11 @@ out: }/* -* Insert an extent into an inode btree. +* Insert an extent into a btree. * -* The caller needs to update fe->i_clusters +* The caller needs to update the owning btree's cluster count. */ -int ocfs2_insert_extent(struct ocfs2_super *osb, - handle_t *handle, - struct inode *inode, +int ocfs2_insert_extent(handle_t *handle, struct ocfs2_extent_tree *et, u32 cpos, u64 start_blk,
@@ -4539,8 +4537,9 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,struct ocfs2_insert_type insert = {0 , };struct ocfs2_extent_rec rec; -mlog (0 ,"add %u clusters at position %u to inode %llu\n" , - new_clusters, cpos, (unsigned long long )OCFS2_I (inode)->ip_blkno); +mlog (0 ,"add %u clusters at position %u to owner %llu\n" , + new_clusters, cpos, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci));memset (&rec,0 ,sizeof (rec)); rec.e_cpos =cpu_to_le32 (cpos);
@@ -4667,8 +4666,7 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb, block =ocfs2_clusters_to_blocks (osb->sb, bit_off);mlog (0 ,"Allocating %u clusters at block %u for inode %llu\n" , num_bits, bit_off, (unsigned long long )OCFS2_I (inode)->ip_blkno); - status =ocfs2_insert_extent (osb, handle, inode, et, - *logical_offset, block, + status =ocfs2_insert_extent (handle, et, *logical_offset, block, num_bits, flags, meta_ac);if (status <0 ) {mlog_errno (status);
@@ -7057,8 +7055,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,* the in-inode data from our pages. */ ocfs2_init_dinode_extent_tree (&et, inode, di_bh); - ret =ocfs2_insert_extent (osb, handle, inode, &et, -0 , block,1 ,0 ,NULL ); + ret =ocfs2_insert_extent (handle, &et,0 , block,1 ,0 ,NULL );if (ret) {mlog_errno (ret); goto out_commit;
fs/ocfs2/alloc.h +1 -3
@@ -87,9 +87,7 @@ int ocfs2_read_extent_block(struct ocfs2_caching_info *ci, u64 eb_blkno, struct buffer_head **bh);struct ocfs2_alloc_context ; -int ocfs2_insert_extent(struct ocfs2_super *osb, - handle_t *handle, - struct inode *inode, +int ocfs2_insert_extent(handle_t *handle, struct ocfs2_extent_tree *et, u32 cpos, u64 start_blk,
fs/ocfs2/dir.c +2 -2
@@ -1535,7 +1535,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,* This should never fail as our extent list is empty and all * related blocks have been journaled already. */ - ret =ocfs2_insert_extent (osb, handle, dir, &et,0 , blkno, len, + ret =ocfs2_insert_extent (handle, &et,0 , blkno, len,0 ,NULL );if (ret) {mlog_errno (ret);
@@ -1567,7 +1567,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, } blkno =ocfs2_clusters_to_blocks (dir->i_sb, bit_off); - ret =ocfs2_insert_extent (osb, handle, dir, &et,1 , + ret =ocfs2_insert_extent (handle, &et,1 , blkno, len,0 ,NULL );if (ret) {mlog_errno (ret);
fs/ocfs2/xattr.c +1 -1
@@ -4318,7 +4318,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,mlog (0 ,"Insert %u clusters at block %llu for xattr at %u\n" , num_bits, (unsigned long long )block, v_start); - ret =ocfs2_insert_extent (osb, handle, inode, &et, v_start, block, + ret =ocfs2_insert_extent (handle, &et, v_start, block, num_bits,0 , ctxt->meta_ac);if (ret <0 ) {mlog_errno (ret);
Signature · 1 line
1.5.6.5
PATCH 36/40 ocfs2: ocfs2_add_clusters_in_btree() no longer needs struct inode.
In reply to Joel BeckerOne more function that doesn't need a struct inode to pass to its children.
--- fs/ocfs2/alloc.c | 13 +++++++------ fs/ocfs2/alloc.h | 6 ++---- fs/ocfs2/file.c | 7 +++---- fs/ocfs2/xattr.c | 7 ++----- 4 files changed, 14 insertions(+), 19 deletions(-)
fs/ocfs2/alloc.c +7 -6
@@ -4596,13 +4596,11 @@ bail:* it is not limited to the file storage. Any extent tree can use this * function if it implements the proper ocfs2_extent_tree. */ -int ocfs2_add_clusters_in_btree (struct ocfs2_super *osb, -struct inode *inode, +int ocfs2_add_clusters_in_btree (handle_t *handle, +struct ocfs2_extent_tree *et,u32 *logical_offset,u32 clusters_to_add,int mark_unwritten, -struct ocfs2_extent_tree *et, -handle_t *handle,struct ocfs2_alloc_context *data_ac,struct ocfs2_alloc_context *meta_ac,enum ocfs2_alloc_restarted *reason_ret)
@@ -4613,6 +4611,8 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,u32 bit_off, num_bits;u64 block;u8 flags =0 ; +struct ocfs2_super *osb = +OCFS2_SB (ocfs2_metadata_cache_get_super (et->et_ci));BUG_ON (!clusters_to_add);
@@ -4664,8 +4664,9 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb, } block =ocfs2_clusters_to_blocks (osb->sb, bit_off); -mlog (0 ,"Allocating %u clusters at block %u for inode %llu\n" , - num_bits, bit_off, (unsigned long long )OCFS2_I (inode)->ip_blkno); +mlog (0 ,"Allocating %u clusters at block %u for owner %llu\n" , + num_bits, bit_off, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci)); status =ocfs2_insert_extent (handle, et, *logical_offset, block, num_bits, flags, meta_ac);if (status <0 ) {
fs/ocfs2/alloc.h +2 -4
@@ -100,13 +100,11 @@ enum ocfs2_alloc_restarted {RESTART_TRANS , RESTART_META }; -int ocfs2_add_clusters_in_btree (struct ocfs2_super *osb, -struct inode *inode, +int ocfs2_add_clusters_in_btree (handle_t *handle, +struct ocfs2_extent_tree *et,u32 *logical_offset,u32 clusters_to_add,int mark_unwritten, -struct ocfs2_extent_tree *et, -handle_t *handle,struct ocfs2_alloc_context *data_ac,struct ocfs2_alloc_context *meta_ac,enum ocfs2_alloc_restarted *reason_ret);
fs/ocfs2/file.c +3 -4
@@ -513,10 +513,9 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,struct ocfs2_extent_tree et;ocfs2_init_dinode_extent_tree (&et, inode, fe_bh); - ret =ocfs2_add_clusters_in_btree (osb, inode, logical_offset, - clusters_to_add, mark_unwritten, - &et, handle, - data_ac, meta_ac, reason_ret); + ret =ocfs2_add_clusters_in_btree (handle, &et, logical_offset, + clusters_to_add, mark_unwritten, + data_ac, meta_ac, reason_ret);return ret; }
fs/ocfs2/xattr.c +2 -5
@@ -592,7 +592,6 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,int status =0 ;handle_t *handle = ctxt->handle;enum ocfs2_alloc_restarted why; -struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);u32 prev_clusters, logical_start =le32_to_cpu (vb->vb_xv->xr_clusters);struct ocfs2_extent_tree et;
@@ -608,13 +607,11 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode, } prev_clusters =le32_to_cpu (vb->vb_xv->xr_clusters); - status =ocfs2_add_clusters_in_btree (osb, - inode, + status =ocfs2_add_clusters_in_btree (handle, + &et, &logical_start, clusters_to_add,0 , - &et, - handle, ctxt->data_ac, ctxt->meta_ac, &why);
Signature · 1 line
1.5.6.5
PATCH 37/40 ocfs2: ocfs2_remove_extent() no longer needs struct inode.
In reply to Joel BeckerOne more generic btree function that is isolated from struct inode.
--- fs/ocfs2/alloc.c | 40 +++++++++++++++++++++------------------- fs/ocfs2/alloc.h | 5 ++--- fs/ocfs2/xattr.c | 4 ++-- 3 files changed, 25 insertions(+), 24 deletions(-)
fs/ocfs2/alloc.c +21 -19
@@ -5011,8 +5011,8 @@ out:return ret; } -static int ocfs2_split_tree (struct inode *inode,struct ocfs2_extent_tree *et, -handle_t *handle,struct ocfs2_path *path, +static int ocfs2_split_tree (handle_t *handle,struct ocfs2_extent_tree *et, +struct ocfs2_path *path,int index,u32 new_range,struct ocfs2_alloc_context *meta_ac) {
@@ -5029,7 +5029,8 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et,*/ el =path_leaf_el (path); rec = &el->l_recs[index]; -ocfs2_make_right_split_rec (inode->i_sb, &split_rec, new_range, rec); +ocfs2_make_right_split_rec (ocfs2_metadata_cache_get_super (et->et_ci), + &split_rec, new_range, rec); depth = path->p_tree_depth;if (depth >0 ) {
@@ -5237,9 +5238,9 @@ out:return ret; } -int ocfs2_remove_extent (struct inode *inode, +int ocfs2_remove_extent (handle_t *handle,struct ocfs2_extent_tree *et, -u32 cpos,u32 len,handle_t *handle, +u32 cpos,u32 len,struct ocfs2_alloc_context *meta_ac,struct ocfs2_cached_dealloc_ctxt *dealloc) {
@@ -5271,10 +5272,11 @@ int ocfs2_remove_extent(struct inode *inode, el =path_leaf_el (path); index =ocfs2_search_extent_list (el, cpos);if (index ==-1 || index >=le16_to_cpu (el->l_next_free_rec)) { -ocfs2_error (inode->i_sb, -"Inode %llu has an extent at cpos %u which can no " +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci), +"Owner %llu has an extent at cpos %u which can no " "longer be found.\n" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, cpos); + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), + cpos); ret = -EROFS ; goto out; }
@@ -5301,9 +5303,10 @@ int ocfs2_remove_extent(struct inode *inode,BUG_ON (cpos <le32_to_cpu (rec->e_cpos) || trunc_range > rec_range); -mlog (0 ,"Inode %llu, remove (cpos %u, len %u). Existing index %d " +mlog (0 ,"Owner %llu, remove (cpos %u, len %u). Existing index %d " "(cpos %u, len %u)\n" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, cpos, len, index, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), + cpos, len, index,le32_to_cpu (rec->e_cpos),ocfs2_rec_clusters (el, rec));if (le32_to_cpu (rec->e_cpos) == cpos || rec_range == trunc_range) {
@@ -5314,7 +5317,7 @@ int ocfs2_remove_extent(struct inode *inode, goto out; } }else { - ret =ocfs2_split_tree (inode, et, handle, path, index, + ret =ocfs2_split_tree (handle, et, path, index, trunc_range, meta_ac);if (ret) {mlog_errno (ret);
@@ -5336,9 +5339,9 @@ int ocfs2_remove_extent(struct inode *inode, el =path_leaf_el (path); index =ocfs2_search_extent_list (el, cpos);if (index ==-1 || index >=le16_to_cpu (el->l_next_free_rec)) { -ocfs2_error (inode->i_sb, -"Inode %llu: split at cpos %u lost record." , - (unsigned long long )OCFS2_I (inode)->ip_blkno, +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci), +"Owner %llu: split at cpos %u lost record." , + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), cpos); ret = -EROFS ; goto out;
@@ -5352,10 +5355,10 @@ int ocfs2_remove_extent(struct inode *inode, rec_range =le32_to_cpu (rec->e_cpos) +ocfs2_rec_clusters (el, rec);if (rec_range != trunc_range) { -ocfs2_error (inode->i_sb, -"Inode %llu: error after split at cpos %u" +ocfs2_error (ocfs2_metadata_cache_get_super (et->et_ci), +"Owner %llu: error after split at cpos %u" "trunc len %u, existing record is (%u,%u)" , - (unsigned long long )OCFS2_I (inode)->ip_blkno, + (unsigned long long )ocfs2_metadata_cache_owner (et->et_ci), cpos, len,le32_to_cpu (rec->e_cpos),ocfs2_rec_clusters (el, rec)); ret = -EROFS ;
@@ -5420,8 +5423,7 @@ int ocfs2_remove_btree_range(struct inode *inode,vfs_dq_free_space_nodirty (inode,ocfs2_clusters_to_bytes (inode->i_sb, len)); - ret =ocfs2_remove_extent (inode, et, cpos, len, handle, meta_ac, - dealloc); + ret =ocfs2_remove_extent (handle, et, cpos, len, meta_ac, dealloc);if (ret) {mlog_errno (ret); goto out_commit;
fs/ocfs2/alloc.h +2 -3
@@ -114,9 +114,8 @@ int ocfs2_mark_extent_written(struct inode *inode, handle_t *handle, u32 cpos, u32 len, u32 phys, struct ocfs2_alloc_context *meta_ac, struct ocfs2_cached_dealloc_ctxt *dealloc); -int ocfs2_remove_extent (struct inode *inode, -struct ocfs2_extent_tree *et, -u32 cpos,u32 len,handle_t *handle, +int ocfs2_remove_extent (handle_t *handle,struct ocfs2_extent_tree *et, +u32 cpos,u32 len,struct ocfs2_alloc_context *meta_ac,struct ocfs2_cached_dealloc_ctxt *dealloc); int ocfs2_remove_btree_range(struct inode *inode,
fs/ocfs2/xattr.c +2 -2
@@ -658,7 +658,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode, goto out; } - ret =ocfs2_remove_extent (inode, &et, cpos, len, handle, ctxt->meta_ac, + ret =ocfs2_remove_extent (handle, &et, cpos, len, ctxt->meta_ac, &ctxt->dealloc);if (ret) {mlog_errno (ret);
@@ -4860,7 +4860,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode, goto out_commit; } - ret =ocfs2_remove_extent (inode, &et, cpos, len, handle, meta_ac, + ret =ocfs2_remove_extent (handle, &et, cpos, len, meta_ac, &dealloc);if (ret) {mlog_errno (ret);
Signature · 1 line
1.5.6.5
PATCH 38/40 ocfs2: ocfs2_split_and_insert() no longer needs struct inode.
In reply to Joel BeckerIt already has an extent_tree.
--- fs/ocfs2/alloc.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
fs/ocfs2/alloc.c +5 -6
@@ -4717,10 +4717,9 @@ static void ocfs2_make_right_split_rec(struct super_block *sb, split_rec->e_flags = rec->e_flags; } -static int ocfs2_split_and_insert(struct inode *inode, - handle_t *handle, - struct ocfs2_path *path, +static int ocfs2_split_and_insert(handle_t *handle, struct ocfs2_extent_tree *et, + struct ocfs2_path *path, struct buffer_head **last_eb_bh, int split_index, struct ocfs2_extent_rec *orig_split_rec,
@@ -4782,8 +4781,8 @@ leftright:*/ insert.ins_split =SPLIT_RIGHT ; -ocfs2_make_right_split_rec (inode->i_sb, &tmprec, insert_range, - &rec); +ocfs2_make_right_split_rec (ocfs2_metadata_cache_get_super (et->et_ci), + &tmprec, insert_range, &rec); split_rec = tmprec;
@@ -4913,7 +4912,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,if (ctxt.c_split_covers_rec) el->l_recs[split_index] = *split_rec;else - ret =ocfs2_split_and_insert (inode, handle, path, et, + ret =ocfs2_split_and_insert (handle, et, path, &last_eb_bh, split_index, split_rec, meta_ac);if (ret)
Signature · 1 line
1.5.6.5
PATCH 39/40 ocfs2: __ocfs2_mark_extent_written() doesn't need struct inode.
In reply to Joel BeckerWe only allow unwritten extents on data, so the toplevel ocfs2_mark_extent_written() can use an inode all it wants. But the subfunction isn't even using the inode argument.
--- fs/ocfs2/alloc.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
fs/ocfs2/alloc.c +3 -4
@@ -4841,9 +4841,8 @@ out:* have been brought into cache (and pinned via the journal), so the * extra overhead is not expressed in terms of disk reads. */ -static int __ocfs2_mark_extent_written(struct inode *inode, +static int __ocfs2_mark_extent_written(handle_t *handle, struct ocfs2_extent_tree *et, - handle_t *handle, struct ocfs2_path *path, int split_index, struct ocfs2_extent_rec *split_rec,
@@ -4877,7 +4876,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,/* * The core merge / split code wants to know how much room is -* left in this inodes allocation tree, so we pass the +* left in this allocation tree, so we pass the * rightmost extent list. */ if (path->p_tree_depth) {
@@ -4999,7 +4998,7 @@ int ocfs2_mark_extent_written(struct inode *inode, split_rec.e_flags =path_leaf_el (left_path)->l_recs[index].e_flags; split_rec.e_flags &= ~OCFS2_EXT_UNWRITTEN ; - ret =__ocfs2_mark_extent_written (inode, et, handle, left_path, + ret =__ocfs2_mark_extent_written (handle, et, left_path, index, &split_rec, meta_ac, dealloc);if (ret)
Signature · 1 line
1.5.6.5
PATCH 40/40 ocfs2: Pass ocfs2_caching_info into ocfs_init_*_extent_tree().
In reply to Joel BeckerWith this commit, extent tree operations are divorced from inodes and rely on ocfs2_caching_info. Phew!
--- fs/ocfs2/alloc.c | 18 +++++++++--------- fs/ocfs2/alloc.h | 6 +++--- fs/ocfs2/aops.c | 6 ++++-- fs/ocfs2/dir.c | 5 +++-- fs/ocfs2/file.c | 6 +++--- fs/ocfs2/xattr.c | 8 ++++---- 6 files changed, 26 insertions(+), 23 deletions(-)
fs/ocfs2/alloc.c +9 -9
@@ -319,7 +319,7 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = { }; static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, - struct inode *inode, + struct ocfs2_caching_info *ci, struct buffer_head *bh, ocfs2_journal_access_func access, void *obj,
@@ -327,7 +327,7 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, { et->et_ops = ops; et->et_root_bh = bh; - et->et_ci =INODE_CACHE (inode); + et->et_ci = ci; et->et_root_journal_access = access;if (!obj) obj = (void *)bh->b_data;
@@ -341,26 +341,26 @@ static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, }void ocfs2_init_dinode_extent_tree (struct ocfs2_extent_tree *et, -struct inode *inode, +struct ocfs2_caching_info *ci,struct buffer_head *bh) { -__ocfs2_init_extent_tree (et, inode, bh, ocfs2_journal_access_di, +__ocfs2_init_extent_tree (et, ci, bh, ocfs2_journal_access_di,NULL , &ocfs2_dinode_et_ops); }void ocfs2_init_xattr_tree_extent_tree (struct ocfs2_extent_tree *et, -struct inode *inode, +struct ocfs2_caching_info *ci,struct buffer_head *bh) { -__ocfs2_init_extent_tree (et, inode, bh, ocfs2_journal_access_xb, +__ocfs2_init_extent_tree (et, ci, bh, ocfs2_journal_access_xb,NULL , &ocfs2_xattr_tree_et_ops); }void ocfs2_init_xattr_value_extent_tree (struct ocfs2_extent_tree *et, -struct inode *inode, +struct ocfs2_caching_info *ci,struct ocfs2_xattr_value_buf *vb) { -__ocfs2_init_extent_tree (et, inode, vb->vb_bh, vb->vb_access, vb, +__ocfs2_init_extent_tree (et, ci, vb->vb_bh, vb->vb_access, vb, &ocfs2_xattr_value_et_ops); }
@@ -7055,7 +7055,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,* this proves to be false, we could always re-build * the in-inode data from our pages. */ -ocfs2_init_dinode_extent_tree (&et, inode, di_bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (inode), di_bh); ret =ocfs2_insert_extent (handle, &et,0 , block,1 ,0 ,NULL );if (ret) {mlog_errno (ret);
fs/ocfs2/alloc.h +3 -3
@@ -68,14 +68,14 @@ struct ocfs2_extent_tree {* specified object buffer. */ void ocfs2_init_dinode_extent_tree (struct ocfs2_extent_tree *et, -struct inode *inode, +struct ocfs2_caching_info *ci,struct buffer_head *bh);void ocfs2_init_xattr_tree_extent_tree (struct ocfs2_extent_tree *et, -struct inode *inode, +struct ocfs2_caching_info *ci,struct buffer_head *bh);struct ocfs2_xattr_value_buf ;void ocfs2_init_xattr_value_extent_tree (struct ocfs2_extent_tree *et, -struct inode *inode, +struct ocfs2_caching_info *ci,struct ocfs2_xattr_value_buf *vb);/*
fs/ocfs2/aops.c +4 -2
@@ -1260,7 +1260,8 @@ static int ocfs2_write_cluster(struct address_space *mapping, goto out; } }else if (unwritten) { -ocfs2_init_dinode_extent_tree (&et, inode, wc->w_di_bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (inode), + wc->w_di_bh); ret =ocfs2_mark_extent_written (inode, &et, wc->w_handle, cpos,1 , phys, meta_ac, &wc->w_dealloc);
@@ -1704,7 +1705,8 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, (long long )i_size_read (inode),le32_to_cpu (di->i_clusters), clusters_to_alloc, extents_to_split); -ocfs2_init_dinode_extent_tree (&et, inode, wc->w_di_bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (inode), + wc->w_di_bh); ret =ocfs2_lock_allocators (inode, &et, clusters_to_alloc, extents_to_split, &data_ac, &meta_ac);
fs/ocfs2/dir.c +3 -2
@@ -1414,7 +1414,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,struct ocfs2_extent_tree et;int did_quota =0 ; -ocfs2_init_dinode_extent_tree (&et, dir, di_bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (dir), di_bh); alloc =ocfs2_clusters_for_bytes (sb, bytes);
@@ -1723,7 +1723,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,spin_lock (&OCFS2_I (dir)->ip_lock);if (dir_i_size ==ocfs2_clusters_to_bytes (sb,OCFS2_I (dir)->ip_clusters)) {spin_unlock (&OCFS2_I (dir)->ip_lock); -ocfs2_init_dinode_extent_tree (&et, dir, parent_fe_bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (dir), + parent_fe_bh); num_free_extents =ocfs2_num_free_extents (osb, &et);if (num_free_extents <0 ) { status = num_free_extents;
fs/ocfs2/file.c +3 -3
@@ -512,7 +512,7 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,int ret;struct ocfs2_extent_tree et; -ocfs2_init_dinode_extent_tree (&et, inode, fe_bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (inode), fe_bh); ret =ocfs2_add_clusters_in_btree (handle, &et, logical_offset, clusters_to_add, mark_unwritten, data_ac, meta_ac, reason_ret);
@@ -560,7 +560,7 @@ restart_all: (unsigned long long )OCFS2_I (inode)->ip_blkno, (long long )i_size_read (inode),le32_to_cpu (fe->i_clusters), clusters_to_add); -ocfs2_init_dinode_extent_tree (&et, inode, bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (inode), bh); status =ocfs2_lock_allocators (inode, &et, clusters_to_add,0 , &data_ac, &meta_ac);if (status) {
@@ -1384,7 +1384,7 @@ static int ocfs2_remove_inode_range(struct inode *inode,struct address_space *mapping = inode->i_mapping;struct ocfs2_extent_tree et; -ocfs2_init_dinode_extent_tree (&et, inode, di_bh); +ocfs2_init_dinode_extent_tree (&et,INODE_CACHE (inode), di_bh);ocfs2_init_dealloc_ctxt (&dealloc);if (byte_len ==0 )
fs/ocfs2/xattr.c +4 -4
@@ -597,7 +597,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,mlog (0 ,"(clusters_to_add for xattr= %u)\n" , clusters_to_add); -ocfs2_init_xattr_value_extent_tree (&et, inode, vb); +ocfs2_init_xattr_value_extent_tree (&et,INODE_CACHE (inode), vb); status = vb->vb_access (handle,INODE_CACHE (inode), vb->vb_bh,OCFS2_JOURNAL_ACCESS_WRITE );
@@ -649,7 +649,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,handle_t *handle = ctxt->handle;struct ocfs2_extent_tree et; -ocfs2_init_xattr_value_extent_tree (&et, inode, vb); +ocfs2_init_xattr_value_extent_tree (&et,INODE_CACHE (inode), vb); ret = vb->vb_access (handle,INODE_CACHE (inode), vb->vb_bh,OCFS2_JOURNAL_ACCESS_WRITE );
@@ -4259,7 +4259,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode, (unsigned long long )OCFS2_I (inode)->ip_blkno, prev_cpos, (unsigned long long)bucket_blkno(first)); -ocfs2_init_xattr_tree_extent_tree (&et, inode, root_bh); +ocfs2_init_xattr_tree_extent_tree (&et,INODE_CACHE (inode), root_bh); ret =ocfs2_journal_access_xb (handle,INODE_CACHE (inode), root_bh,OCFS2_JOURNAL_ACCESS_WRITE );
@@ -4820,7 +4820,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,struct ocfs2_cached_dealloc_ctxt dealloc;struct ocfs2_extent_tree et; -ocfs2_init_xattr_tree_extent_tree (&et, inode, root_bh); +ocfs2_init_xattr_tree_extent_tree (&et,INODE_CACHE (inode), root_bh);ocfs2_init_dealloc_ctxt (&dealloc);
Signature · 1 line
1.5.6.5
cover ocfs2: Detach ocfs2 metadata I/O from struct inode
In reply to Joel BeckerHi Joel,
I deem that 1-3 is the same as the patch you sent to me several days
ago. right? As I have reviewed them before, so didn't touch them this time.
For 4~7, read them and like them. Just small comments ;) For 8~40, since they are just replacing parameters. Just skim them.
anyway, They are cool and relieve me from my current work. Thank you very much.
For all the patches, Acked-by: Tao Ma <[email protected]>
Regards,
Tao
Quoted 127 lines · Joel Becker
The following series of patches attempts to detach metadata I/O from
struct inode. They are currently tied together pretty tightly.
Metadata reads happen via theocfs2_read_blocks()functions, writes via both jbd2 andocfs2_write_blocks().- Each inode has a cache of associated metadata blocks stored on its
ip_metadata_cachemember. The ocfs2_read/write_blocks() functions take a struct inode to access this member.- The journal mostly doesn't care about inodes. It does, however, need to set the transaction id on the inode so that dlmglue knows when an inode needs to checkpoint.
- All the metadata I/O paths use
ip_io_mutexto synchronize their actions against each other.The problem is that if someone wants to use our metadata I/O facilities, they have to have a struct inode. But not everything in ocfs2 is an inode (even if it seems that way sometimes). So we want to disconnect them.
It turns out that most of what goes on is about
ocfs2_caching_info. So if we move the last few relevant bits toocfs2_caching_info, we can then embedocfs2_caching_infointo another structure just as easily as we do inside struct inode. That's the theory, anyway.The first three patches move the cache code to
ocfs2_caching_infoentirely. The functions affecting the metadata cache, likeocfs2_set_buffer_uptodate(), etc, take a structocfs2_caching_infoinstead of a struct inode. That sort of thing. It's nice and easy.The next three patches move the journal transaction ids to struct
ocfs2_caching_info. When they are done, the ocfs2_journal_access*() functions take a stuctocfs2_caching_info, and the dlmglue checks theocfs2_caching_inforegarding checkpoints. So it only takes us six patches to isolateocfs2_caching_infoin the metadata I/O API.The remaining 34 patches slowly but surely move
alloc.cto the new API. Our btree code is heavily invested in the idea that all btrees are rooted, somehow, at an inode. Since we want to root a btree at a non-inode, we need to fix that. The good news, of course, is that theocfs2_extent_treeabstraction is already there to rescue us. We attach theocfs2_caching_infoto a particularocfs2_extent_tree, and we can then send thatocfs2_extent_treedown through the btree code. At the end of this series, the generic btree code doesn't reference struct inode at all.There are a lot of patches because this entire series is supposed to be isomorphic. No behavior is to change, just the flexibility of our API. Thus, each patch tries to be readily understandable. Thank you for your patience!
[View]
http://oss.oracle.com/git/?p=jlbec/linux-2.6.git;a=shortlog;h=cacheme
[Pull]git://oss.oracle.com/git/jlbec/linux-2.6.gitcachemeJoel Becker (40):
ocfs2: Make theocfs2_caching_infostructure self-contained.
ocfs2: Change metadata caching locks to an operations structure.
ocfs2: Take the inode out of the metadata read/write paths.
ocfs2: moveip_last_transto structocfs2_caching_info
ocfs2: moveip_created_transto structocfs2_caching_info
ocfs2: Pass structocfs2_caching_infoto the journal functions.
ocfs2: Store theocfs2_caching_infoonocfs2_extent_tree.
ocfs2: Passocfs2_caching_infotoocfs2_read_extent_block().
ocfs2:ocfs2_find_path()only needs the caching info
ocfs2:ocfs2_create_new_meta_bhs()doesn't need struct inode.
ocfs2: Passocfs2_extent_treetoocfs2_unlink_path()
ocfs2:ocfs2_complete_edge_insert()doesn't need struct inode at all.
ocfs2: Get inode out ofocfs2_rotate_subtree_root_right().
ocfs2: Passocfs2_extent_treetoocfs2_get_subtree_root()
ocfs2: Drop struct inode fromocfs2_extent_tree_operations.
ocfs2:ocfs2_rotate_tree_right()doesn't need struct inode.
ocfs2:ocfs2_update_edge_lengths()doesn't need struct inode.
ocfs2:ocfs2_rotate_subtree_left()doesn't need struct inode.
ocfs2:__ocfs2_rotate_tree_left()doesn't need struct inode.
ocfs2:ocfs2_rotate_tree_left()no longer needs struct inode.
ocfs2: ocfs2_merge_rec_left/right() no longer need struct inode.
ocfs2:ocfs2_try_to_merge_extent()doesn't need struct inode.
ocfs2:ocfs2_grow_branch()no longer needs struct inode.
ocfs2:ocfs2_append_rec_to_path()loses struct inode.
ocfs2:ocfs2_truncate_rec()doesn't need struct inode.
ocfs2: Make truncating the extent map anextent_tree_operation.
ocfs2:ocfs2_insert_at_leaf()doesn't need struct inode.
ocfs2: Giveocfs2_split_record()anextent_treeinstead of an inode.
ocfs2:ocfs2_do_insert_extent()andocfs2_insert_path()no longer need an
ocfs2:ocfs2_extent_contig()only requires the superblock.
ocfs2: Swap inode forextent_treeinocfs2_figure_merge_contig_type().
ocfs2: Remove inode fromocfs2_figure_extent_contig().
ocfs2:ocfs2_figure_insert_type()no longer needs struct inode.
ocfs2: Make extent map insertion anextent_tree_operation.
ocfs2:ocfs2_insert_extent()no longer needs struct inode.
ocfs2:ocfs2_add_clusters_in_btree()no longer needs struct inode.
ocfs2:ocfs2_remove_extent()no longer needs struct inode.
ocfs2:ocfs2_split_and_insert()no longer needs struct inode.
ocfs2:__ocfs2_mark_extent_written()doesn't need struct inode.
ocfs2: Passocfs2_caching_infointo ocfs_init_*_extent_tree().alloc.c | 896 ++++++++++++++++++++++++++++--------------------------- alloc.h | 33 -- aops.c | 10 buffer_head_io.c | 47 +- buffer_head_io.h | 8 dir.c | 38 +- dlmglue.c | 4 extent_map.c | 14 file.c | 21 - inode.c | 80 ++++ inode.h | 20 - journal.c | 53 +-- journal.h | 70 ++-- localalloc.c | 12 namei.c | 37 +- ocfs2.h | 38 ++ quota_global.c | 5 quota_local.c | 16 resize.c | 16 slot_map.c | 10 suballoc.c | 35 +- super.c | 5 uptodate.c | 265 +++++++++------- uptodate.h | 51 ++- xattr.c | 81 ++-- 25 files changed, 1056 insertions(+), 809 deletions(-)