Skip to contentSkip to conversation

ext4: Add EXT4_IOC_PRINT_GLOBAL_ARULE for debug block allocation restriction

RFC PATCH In review Akira Fujita 1 participant 1 message Jun 23, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 6/7 ext4: Add EXT4_IOC_PRINT_GLOBAL_ARULE for debug block allocation restriction

ext4: Add EXT4_IOC_PRINT_GLOBAL_ARULE for debug block allocation restriction

From: Akira Fujita <[email protected]>

This is a debug ioctl for block allocation restriction

EXT4_IOC_PRINT_GLOBAL_ARULE prints the information of block allocation restriction to syslog.

  #define EXT4_IOC_PRINT_GLOBAL_ARULE     _IO('f', 19)

This information consists of following three entries.
- start physical offset
- end physical offset
- flag (0: mandatory, 1:advisory)

e.g. ARULE: start=10000 end=13999 flag=1

The above means ext4 FS where target fd located in is set block allocation restriction from 10000 to 13999 with advisory. Block allocator use blocks from 10000 to 13999 with precedence, if it can not use them, then block allocator tries to use blocks from other range.

---
 fs/ext4/ext4.h    |    2 ++
 fs/ext4/ioctl.c   |    5 +++++
 fs/ext4/mballoc.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 0 deletions(-)
fs/ext4/ext4.h +2 -0
index b6469d5..4ed4b27 100644
@@ -362,6 +362,7 @@ struct ext4_new_group_data {
 #define EXT4_IOC_ADD_GLOBAL_ALLOC_RULE	_IOW('f', 16, struct ext4_alloc_rule)
 #define EXT4_IOC_CLR_GLOBAL_ALLOC_RULE	_IOW('f', 17, struct ext4_alloc_rule)
 #define EXT4_IOC_ADD_INODE_ALLOC_RULE	_IOW('f', 18, struct ext4_alloc_rule)
+#define EXT4_IOC_PRINT_GLOBAL_ARULE	_IO('f', 19)
 
 /*
  * ioctl commands in 32 bit emulation
@@ -1404,6 +1405,7 @@ extern int ext4_mb_add_inode_arule(struct inode *inode,
 					struct ext4_alloc_rule *arule);
 extern void ext4_mb_del_inode_arule(struct inode *inode);
 extern void ext4_mb_dec_inode_arule(struct inode *inode, unsigned int len);
+extern void ext4_mb_print_global_arule(struct inode *inode);
 
 /* inode.c */
 int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
fs/ext4/ioctl.c +5 -0
index b009132..323e3d2 100644
@@ -318,6 +318,11 @@ setversion_out:
 		return err;
 	}
 
+	case EXT4_IOC_PRINT_GLOBAL_ARULE: {
+		ext4_mb_print_global_arule(inode);
+		return 0;
+	}
+
 	case EXT4_IOC_GROUP_ADD: {
 		struct ext4_new_group_data input;
 		struct super_block *sb = inode->i_sb;
fs/ext4/mballoc.c +45 -0

48 lines not on this page · raw message