From: Jan Kara <jack@suse.cz>
To: linux-kernel@vger.kernel.org
Cc: linux-ext4@vger.kernel.org
Subject: [RFC] [PATCH 0/3] Recursive mtime for ext3
Date: Tue, 6 Nov 2007 18:15:37 +0100 [thread overview]
Message-ID: <20071106171537.GD23689@duck.suse.cz> (raw)
[-- Attachment #1: Type: text/plain, Size: 546 bytes --]
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@suse.cz>
SUSE Labs, CR
[-- Attachment #2: set_recmod.c --]
[-- Type: text/x-c++src, Size: 643 bytes --]
#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;
}
[-- Attachment #3: get_recmod.c --]
[-- Type: text/x-c++src, Size: 723 bytes --]
#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;
}
[-- Attachment #4: e2fsprogs-rec_mtime.diff --]
[-- Type: text/x-patch, Size: 2425 bytes --]
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 */
};
next reply other threads:[~2007-11-06 17:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-06 17:15 Jan Kara [this message]
2007-11-06 17:18 ` [RFC] [PATCH 1/3] Recursive mtime for ext3 Jan Kara
2007-11-06 17:19 ` [RFC] [PATCH 2/3] " Jan Kara
2007-11-06 17:19 ` [RFC] [PATCH 3/3] " Jan Kara
2007-11-06 17:40 ` Arjan van de Ven
2007-11-06 18:04 ` H. Peter Anvin
2007-11-07 11:51 ` Jan Kara
2007-11-06 18:01 ` Al Viro
2007-11-07 14:54 ` Jan Kara
2007-11-06 19:40 ` Theodore Tso
2007-11-07 14:36 ` Jan Kara
2007-11-08 0:20 ` Theodore Tso
2007-11-08 10:56 ` Jan Kara
2007-11-08 14:37 ` Theodore Tso
2007-11-08 15:28 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071106171537.GD23689@duck.suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox