aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2.h
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2008-03-05 03:11:46 -0500
committerMark Fasheh <mfasheh@suse.com>2008-04-18 11:56:10 -0400
commit4d0ddb2ce25db2254d468233d942276ecf40bff8 (patch)
tree6a114da03bb9911de637146f2b24866f1ae96718 /fs/ocfs2/ocfs2.h
parenta4a4891164d4f6f383cc17e7c90828a7ca6a1146 (diff)
ocfs2: Add inode stealing for ocfs2_reserve_new_inode
Inode allocation is modified to look in other nodes allocators during extreme out of space situations. We retry our own slot when space is freed back to the global bitmap, or whenever we've allocated more than 1024 inodes from another slot. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/ocfs2.h')
-rw-r--r--fs/ocfs2/ocfs2.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 9ff5811345a9..31692379c170 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -208,11 +208,14 @@ struct ocfs2_super
208 u32 s_feature_incompat; 208 u32 s_feature_incompat;
209 u32 s_feature_ro_compat; 209 u32 s_feature_ro_compat;
210 210
211 /* Protects s_next_generaion, osb_flags. Could protect more on 211 /* Protects s_next_generation, osb_flags and s_inode_steal_slot.
212 * osb as it's very short lived. */ 212 * Could protect more on osb as it's very short lived.
213 */
213 spinlock_t osb_lock; 214 spinlock_t osb_lock;
214 u32 s_next_generation; 215 u32 s_next_generation;
215 unsigned long osb_flags; 216 unsigned long osb_flags;
217 s16 s_inode_steal_slot;
218 atomic_t s_num_inodes_stolen;
216 219
217 unsigned long s_mount_opt; 220 unsigned long s_mount_opt;
218 unsigned int s_atime_quantum; 221 unsigned int s_atime_quantum;
@@ -537,6 +540,33 @@ static inline unsigned int ocfs2_pages_per_cluster(struct super_block *sb)
537 return pages_per_cluster; 540 return pages_per_cluster;
538} 541}
539 542
543static inline void ocfs2_init_inode_steal_slot(struct ocfs2_super *osb)
544{
545 spin_lock(&osb->osb_lock);
546 osb->s_inode_steal_slot = OCFS2_INVALID_SLOT;
547 spin_unlock(&osb->osb_lock);
548 atomic_set(&osb->s_num_inodes_stolen, 0);
549}
550
551static inline void ocfs2_set_inode_steal_slot(struct ocfs2_super *osb,
552 s16 slot)
553{
554 spin_lock(&osb->osb_lock);
555 osb->s_inode_steal_slot = slot;
556 spin_unlock(&osb->osb_lock);
557}
558
559static inline s16 ocfs2_get_inode_steal_slot(struct ocfs2_super *osb)
560{
561 s16 slot;
562
563 spin_lock(&osb->osb_lock);
564 slot = osb->s_inode_steal_slot;
565 spin_unlock(&osb->osb_lock);
566
567 return slot;
568}
569
540#define ocfs2_set_bit ext2_set_bit 570#define ocfs2_set_bit ext2_set_bit
541#define ocfs2_clear_bit ext2_clear_bit 571#define ocfs2_clear_bit ext2_clear_bit
542#define ocfs2_test_bit ext2_test_bit 572#define ocfs2_test_bit ext2_test_bit