Skip to contentSkip to conversation

ext4-block-reservation patch

RFC New Alex Tomas 1 participant 1 message Dec 1, 2006 ext4 file system

lore
Share & tools
lore

Alex Tomas

author
#0 lore raw

RFC 1/1 ext4-block-reservation patch

The patch implements free space management with per-cpu reservation blocks for delayed allocation.

thanks, Alex

include/linux/ext4_fs.h +7 -0
Index: linux-2.6.19-rc6/include/linux/ext4_fs.h
===================================================================
@@ -201,6 +201,7 @@ struct ext4_group_desc
 #define EXT4_STATE_JDATA		0x00000001 /* journaled data exists */
 #define EXT4_STATE_NEW			0x00000002 /* inode is newly created */
 #define EXT4_STATE_XATTR		0x00000004 /* has in-inode xattrs */
+#define EXT4_STATE_BLOCKS_RESERVED	0x00000008 /* blocks reserved */
 
 /* Used to pass group descriptor data when online resize is done */
 struct ext4_new_group_input {
@@ -846,6 +847,12 @@ extern int ext4_should_retry_alloc(struc
 extern void ext4_init_block_alloc_info(struct inode *);
 extern void ext4_rsv_window_add(struct super_block *sb, struct ext4_reserve_window_node *rsv);
 
+/* reservation.c */
+int ext4_reserve_init(struct super_block *sb);
+void ext4_reserve_release(struct super_block *sb);
+void ext4_release_blocks(struct super_block *sb, int blocks);
+int ext4_reserve_blocks(struct super_block *sb, int blocks);
+
 /* dir.c */
 extern int ext4_check_dir_entry(const char *, struct inode *,
 				struct ext4_dir_entry_2 *,
include/linux/ext4_fs_sb.h +5 -0
Index: linux-2.6.19-rc6/include/linux/ext4_fs_sb.h
===================================================================
@@ -24,6 +24,8 @@
 #endif
 #include <linux/rbtree.h>
 
+struct ext4_reservation_slot;
+
 /*
  * third extended-fs super-block data in memory
  */
@@ -65,6 +67,9 @@ struct ext4_sb_info {
 	struct rb_root s_rsv_window_root;
 	struct ext4_reserve_window_node s_rsv_window_head;
 
+	/* global reservation structures */
+	struct ext4_reservation_slot *s_reservation_slots;
+
 	/* Journaling */
 	struct inode * s_journal_inode;
 	struct journal_s * s_journal;
fs/ext4/super.c +2 -0
Index: linux-2.6.19-rc6/fs/ext4/super.c
===================================================================
@@ -439,6 +439,7 @@ static void ext4_put_super (struct super
 	struct ext4_super_block *es = sbi->s_es;
 	int i;
 
+	ext4_reserve_release(sb);
 	ext4_ext_release(sb);
 	ext4_xattr_put_super(sb);
 	jbd2_journal_destroy(sbi->s_journal);
@@ -1866,6 +1867,7 @@ static int ext4_fill_super (struct super
 
 	ext4_lg_init(sb);
 	ext4_ext_init(sb);
+	ext4_reserve_init(sb);
 
 	lock_kernel();
 	return 0;
fs/ext4/Makefile +2 -1
Index: linux-2.6.19-rc6/fs/ext4/Makefile
===================================================================
@@ -5,7 +5,8 @@
 obj-$(CONFIG_EXT4DEV_FS) += ext4dev.o
 
 ext4dev-y	:= balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
-	   ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o lg.o
+	   ioctl.o namei.o super.o symlink.o hash.o resize.o extents.o lg.o \
+	   reservation.o
 
 ext4dev-$(CONFIG_EXT4DEV_FS_XATTR)	+= xattr.o xattr_user.o xattr_trusted.o
 ext4dev-$(CONFIG_EXT4DEV_FS_POSIX_ACL)	+= acl.o
fs/ext4/reservation.c +190 -0

190 lines not on this page · raw message