Skip to contentSkip to conversation

delalloc ENOSPC: Add per-inode counters to store reserved blocks

RFC PATCH In review Mingming Cao 1 participant 1 message Jun 1, 2008 ext4 file system

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/6 delalloc ENOSPC: Add per-inode counters to store reserved blocks

ext4: delalloc -- Adding per inode counters to store reserved blocks

From: Mingming cao <[email protected]>

Add per-inode counters to store number of resreved data blocks and metadata blocks, due to delayed allocation.

---
 fs/ext4/ext4_i.h |    4 ++++
 fs/ext4/super.c  |    2 ++
 2 files changed, 6 insertions(+)
fs/ext4/ext4_i.h +4 -0
Index: linux-2.6.26-rc4/fs/ext4/ext4_i.h
===================================================================
@@ -162,6 +162,10 @@ struct ext4_inode_info {
 	/* mballoc */
 	struct list_head i_prealloc_list;
 	spinlock_t i_prealloc_lock;
+
+	/* allocation reservation info for delalloc */
+	unsigned long i_reserved_data_blocks;
+	unsigned long i_reserved_meta_blocks;
 };
 
 #endif	/* _EXT4_I */
fs/ext4/super.c +2 -0
Index: linux-2.6.26-rc4/fs/ext4/super.c
===================================================================
@@ -572,6 +572,8 @@ static struct inode *ext4_alloc_inode(st
 	memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache));
 	INIT_LIST_HEAD(&ei->i_prealloc_list);
 	spin_lock_init(&ei->i_prealloc_lock);
+	ei->i_reserved_data_blocks = 0;
+	ei->i_reserved_meta_blocks = 0;
 	return &ei->vfs_inode;
 }