[RFC] [PATCH 0/3] Recursive mtime for ext3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  Hello,

  in following three patches is implemented recursive mtime feature for
ext3. The first two patches are mostly clean-up patches, the third patch
implements the feature itself. If somebody is interested in testing this
(or even writing a support of this feature in rsync and similar), please
contact me. Attached are sources of simple tools set_recmod, get_recmod
for testing the feature and also a patch implementing basic support of
the feature in e2fsprogs. Comments welcome.

								Honza

-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

#include <sys/ioctl.h>
#include <linux/fs.h>
#include <linux/ext2_fs.h>

#define EXT2_IOC_GETRTIME _IOR('f', 9, unsigned int)

#define S_RECMOD 0x100000

int main(int argc, char **argv)
{
	int fd;
	long flags;

	if (argc < 2)
		return 1;

	fd = open(argv[1], O_RDONLY);
	if (fd < 0) {
		printf("Cannot open: %m\n");
		return 1;
	}
	if (ioctl(fd, EXT2_IOC_GETFLAGS, &flags) < 0) {
		printf("Cannot get flags: %m\n");
		return 1;
	}
	flags |= S_RECMOD;
	if (ioctl(fd, EXT2_IOC_SETFLAGS, &flags) < 0) {
		printf("Cannot set flags: %m\n");
		return 1;
	}

	return 0;
}
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

#include <sys/ioctl.h>
#include <linux/fs.h>
#include <linux/ext2_fs.h>

#define EXT2_IOC_GETRTIME _IOR('f', 9, unsigned int)

#define S_RECMOD 0x100000

int main(int argc, char **argv)
{
	int fd;
	long flags;
	unsigned time;

	if (argc < 2)
		return 1;

	fd = open(argv[1], O_RDONLY);
	if (fd < 0) {
		printf("Cannot open: %m\n");
		return 1;
	}
	if (ioctl(fd, EXT2_IOC_GETFLAGS, &flags) < 0) {
		printf("Cannot get flags: %m\n");
		return 1;
	}
	if (ioctl(fd, EXT2_IOC_GETRTIME, &time) < 0) {
		printf("Cannot get rtime: %s\n", strerror(errno));
		return 1;
	}
	printf("RECMOD flags: %d, time %u\n", !!(flags & S_RECMOD), time);

	return 0;
}
diff --git a/lib/e2p/feature.c b/lib/e2p/feature.c
index fe7e65a..a12540b 100644
--- a/lib/e2p/feature.c
+++ b/lib/e2p/feature.c
@@ -37,6 +37,8 @@ static struct feature feature_list[] = {
 			"resize_inode" },
 	{	E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_LAZY_BG,
 			"lazy_bg" },
+	{	E2P_FEATURE_COMPAT, EXT2_FEATURE_COMPAT_RTIME,
+			"recursive_mtime" },
 
 	{	E2P_FEATURE_RO_INCOMPAT, EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER,
 			"sparse_super" },
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index a316665..21747c2 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -623,6 +623,7 @@ struct ext2_super_block {
 #define EXT2_FEATURE_COMPAT_RESIZE_INODE	0x0010
 #define EXT2_FEATURE_COMPAT_DIR_INDEX		0x0020
 #define EXT2_FEATURE_COMPAT_LAZY_BG		0x0040
+#define EXT2_FEATURE_COMPAT_RTIME		0x0080
 
 #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER	0x0001
 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE	0x0002
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 83a9091..64b6eb6 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -418,7 +418,8 @@ typedef struct ext2_icount *ext2_icount_
 					 EXT2_FEATURE_COMPAT_RESIZE_INODE|\
 					 EXT2_FEATURE_COMPAT_DIR_INDEX|\
 					 EXT2_FEATURE_COMPAT_LAZY_BG|\
-					 EXT2_FEATURE_COMPAT_EXT_ATTR)
+					 EXT2_FEATURE_COMPAT_EXT_ATTR|\
+					 EXT2_FEATURE_COMPAT_RTIME)
 
 /* This #ifdef is temporary until compression is fully supported */
 #ifdef ENABLE_COMPRESSION
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 4a6cace..5060db7 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -870,7 +870,8 @@ static __u32 ok_features[3] = {
 	EXT3_FEATURE_COMPAT_HAS_JOURNAL |
 		EXT2_FEATURE_COMPAT_RESIZE_INODE |
 		EXT2_FEATURE_COMPAT_DIR_INDEX |
-		EXT2_FEATURE_COMPAT_LAZY_BG,	/* Compat */
+		EXT2_FEATURE_COMPAT_LAZY_BG |
+		EXT2_FEATURE_COMPAT_RTIME,	/* Compat */
 	EXT2_FEATURE_INCOMPAT_FILETYPE|		/* Incompat */
 		EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|
 		EXT2_FEATURE_INCOMPAT_META_BG,
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 833b994..5195e40 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -96,7 +96,8 @@ static void usage(void)
 
 static __u32 ok_features[3] = {
 	EXT3_FEATURE_COMPAT_HAS_JOURNAL |
-		EXT2_FEATURE_COMPAT_DIR_INDEX,	/* Compat */
+		EXT2_FEATURE_COMPAT_DIR_INDEX |
+		EXT2_FEATURE_COMPAT_RTIME,	/* Compat */
 	EXT2_FEATURE_INCOMPAT_FILETYPE,		/* Incompat */
 	EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER	/* R/O compat */
 };

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux