Skip to contentSkip to conversation

generic sreadahead hook ioctls

PATCH/RFC/whatever Kyle McMartin 2 participants 2 messages Dec 10, 2008 – Dec 19, 2008

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

Honestly, I don't know how tracing infrastructure could be used on this, since you want the information to have existed before you want to run sreadahead...

Seems to work for me.

cheers, Kyle

fs/compat_ioctl.c +3 -0
index 5235c67..d796c5e 100644
@@ -2711,6 +2711,9 @@ IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32)
 /* loop */
 IGNORE_IOCTL(LOOP_CLR_FD)
 
+/* fs inode creation jiffies */
+HANDLE_IOCTL(FS_IOC32_CREATION_JIFFIES, w_long)
+
 #ifdef CONFIG_SPARC
 /* Sparc framebuffers, handled in sbusfb_compat_ioctl() */
 IGNORE_IOCTL(FBIOGTYPE)
fs/inode.c +1 -0
index 0487ddb..3304244 100644
@@ -143,6 +143,7 @@ static struct inode *alloc_inode(struct super_block *sb)
 		inode->i_cdev = NULL;
 		inode->i_rdev = 0;
 		inode->dirtied_when = 0;
+		inode->created_when = jiffies;
 		if (security_inode_alloc(inode)) {
 			if (inode->i_sb->s_op->destroy_inode)
 				inode->i_sb->s_op->destroy_inode(inode);
fs/ioctl.c +3 -0
index 43e8b2c..eea758f 100644
@@ -357,6 +357,9 @@ static int file_ioctl(struct file *filp, unsigned int cmd,
 		return ioctl_fibmap(filp, p);
 	case FS_IOC_FIEMAP:
 		return ioctl_fiemap(filp, arg);
+	case FS_IOC_CREATION_JIFFIES:
+	case FS_IOC32_CREATION_JIFFIES:
+		return put_user(inode->created_when, p);
 	case FIGETBSZ:
 		return put_user(inode->i_sb->s_blocksize, p);
 	case FIONREAD:
include/linux/fs.h +4 -0
index 4a853ef..4f91e57 100644
@@ -241,10 +241,12 @@ extern int dir_notify_enable;
 #define	FS_IOC_GETVERSION		_IOR('v', 1, long)
 #define	FS_IOC_SETVERSION		_IOW('v', 2, long)
 #define FS_IOC_FIEMAP			_IOWR('f', 11, struct fiemap)
+#define FS_IOC_CREATION_JIFFIES		_IOR('f', 19, long)
 #define FS_IOC32_GETFLAGS		_IOR('f', 1, int)
 #define FS_IOC32_SETFLAGS		_IOW('f', 2, int)
 #define FS_IOC32_GETVERSION		_IOR('v', 1, int)
 #define FS_IOC32_SETVERSION		_IOW('v', 2, int)
+#define FS_IOC32_CREATION_JIFFIES	_IOR('f', 19, int)
 
 /*
  * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
@@ -685,6 +687,8 @@ struct inode {
 	void			*i_security;
 #endif
 	void			*i_private; /* fs or device private pointer */
+
+	unsigned long		created_when;	/* jiffies of creation time */
 };
 
 /*
#1 lore raw
Quoted 3 lines · Kyle McMartin

Honestly, I don't know how tracing infrastructure could be used on this, since you want the information to have existed before you want to run sreadahead...

I still strongly disagree. You add fields to every struct inode, for a feature only used during boot time on some. Even if you want to stick to the ioctl interface it should be implemented as some sort of tree / hashtable etc that can be freed after the boot is completed.

Thas is if I understood the use case correctly, actually stating it in the patch would be highly appreciated.