Skip to contentSkip to conversation

need attrs patch for 2.5.44-ac3

DISCUSSION Tom Vier 2 participants 6 messages Oct 26, 2002 – Oct 30, 2002

lore
Share & tools
lore

Tom Vier

author
#0 lore raw

is there a 2.5 attrs patch? i can't even list them in 2.5 on a reiserfs. i get "inappropriate ioctl for device".

Signature · 2 lines
Tom Vier <[email protected]>
DSA Key ID 0xE6CB97DA
#1 lore raw

Hello!

Quoted 2 lines · Tom Vier

is there a 2.5 attrs patch? i can't even list them in 2.5 on a reiserfs. i get "inappropriate ioctl for device".

See attached, I do not claim it will apply cleanly, though.
My tree have bunch of other reiserfs pending stuff that was not yet accepted by Linus.

Bye,
Oleg

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.663 -> 1.664
# include/linux/reiserfs_fs_i.h 1.7 -> 1.8

#	fs/reiserfs/procfs.c	1.14    -> 1.15   
#	 fs/reiserfs/inode.c	1.70    -> 1.71   
#	 fs/reiserfs/ioctl.c	1.9     -> 1.10   
#	 fs/reiserfs/super.c	1.55    -> 1.56   

# include/linux/reiserfs_fs_sb.h 1.20 -> 1.21
# fs/reiserfs/dir.c 1.18 -> 1.19
# include/linux/reiserfs_fs.h 1.44 -> 1.45
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/02 [email protected] 1.664
# reiserfs: Extended inode attributes support
# --------------------------------------------
#

fs/reiserfs/dir.c +1 -0
diff -Nru a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
@@ -21,6 +21,7 @@
     .read	= generic_read_dir,
     .readdir	= reiserfs_readdir,
     .fsync	= reiserfs_dir_fsync,
+    .ioctl	= reiserfs_ioctl,
 };
 
 int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) {
fs/reiserfs/inode.c +65 -8

122 lines not on this page · raw message

fs/reiserfs/ioctl.c +58 -4

89 lines not on this page · raw message

fs/reiserfs/procfs.c +6 -0
diff -Nru a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
@@ -350,6 +350,7 @@
 	struct reiserfs_sb_info *sb_info;
 	struct reiserfs_super_block *rs;
 	int hash_code;
+	__u32 flags;
 	int len = 0;
     
 	sb = procinfo_prologue((dev_t)data);
@@ -358,6 +359,7 @@
 	sb_info = REISERFS_SB(sb);
 	rs = sb_info -> s_rs;
 	hash_code = DFL( s_hash_function_code );
+	flags = DJF( s_flags );
 
 	len += sprintf( &buffer[ len ], 
 			"block_count: \t%i\n"
@@ -373,6 +375,7 @@
 			"tree_height: \t%i\n"
 			"bmap_nr: \t%i\n"
 			"version: \t%i\n"
+			"flags: \t%x[%s]\n"
 			"reserved_for_journal: \t%i\n",
 
 			DFL( s_block_count ),
@@ -391,6 +394,9 @@
 			DF( s_tree_height ),
 			DF( s_bmap_nr ),
 			DF( s_version ),
+			flags,
+			( flags & reiserfs_attrs_cleared )
+			? "attrs_cleared" : "",
 			DF (s_reserved_for_journal));
 
 	procinfo_epilogue( sb );
fs/reiserfs/super.c +22 -0
diff -Nru a/fs/reiserfs/super.c b/fs/reiserfs/super.c
@@ -697,6 +697,24 @@
     return 1;
 }
 
+static void handle_attrs( struct super_block *s )
+{
+	struct reiserfs_super_block * rs;
+
+	if( reiserfs_attrs( s ) ) {
+		rs = SB_DISK_SUPER_BLOCK (s);
+		if( old_format_only(s) ) {
+			reiserfs_warning( "reiserfs: cannot support attributes on 3.5.x disk format\n" );
+			REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS );
+			return;
+		}
+		if( !( le32_to_cpu( rs -> s_flags ) & reiserfs_attrs_cleared ) ) {
+				reiserfs_warning( "reiserfs: cannot support attributes until flag is set in super-block\n" );
+				REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS );
+		}
+	}
+}
+
 static int reiserfs_remount (struct super_block * s, int * mount_flags, char * arg)
 {
   struct reiserfs_super_block * rs;
@@ -709,6 +727,8 @@
   if (!reiserfs_parse_options(s, arg, &mount_options, &blocks, NULL))
     return -EINVAL;
   
+  handle_attrs( s );
+
   if(blocks) {
     int rc = reiserfs_resize(s, blocks);
     if (rc != 0)
@@ -1307,6 +1327,8 @@
     }
     // mark hash in super block: it could be unset. overwrite should be ok
     set_sb_hash_function_code( rs, function2code(sbi->s_hash_function ) );
+
+    handle_attrs( s );
 
     reiserfs_proc_info_init( s );
     reiserfs_proc_register( s, "version", reiserfs_version_in_proc );
include/linux/reiserfs_fs.h +42 -1

71 lines not on this page · raw message

include/linux/reiserfs_fs_i.h +3 -0
diff -Nru a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
@@ -32,6 +32,9 @@
 
     __u32 i_first_direct_byte; // offset of first byte stored in direct item.
 
+    /* copy of persistent inode flags read from sd_attrs. */
+    __u32 i_attrs;
+
     int i_prealloc_block; /* first unused block of a sequence of unused blocks */
     int i_prealloc_count; /* length of that sequence */
     struct list_head i_prealloc_list; /* per-transaction list of inodes which
include/linux/reiserfs_fs_sb.h +4 -1
diff -Nru a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
@@ -8,6 +8,9 @@
 #include <linux/tqueue.h>
 #endif
 
+typedef enum {
+  reiserfs_attrs_cleared	= 0x00000001,
+} reiserfs_super_block_flags;
 
 /* struct reiserfs_super_block accessors/mutators
  * since this is a disk structure, it will always be in 
@@ -436,7 +439,6 @@
 #define REISERFS_NO_BORDER 11
 #define REISERFS_NO_UNHASHED_RELOCATION 12
 #define REISERFS_HASHED_RELOCATION 13
-#define REISERFS_TEST4 14 
 
 #define REISERFS_ATTRS 15
 
@@ -458,6 +460,7 @@
 #define have_small_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_SMALLTAIL))
 #define replay_only(s) (REISERFS_SB(s)->s_mount_opt & (1 << REPLAYONLY))
 #define reiserfs_dont_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NOLOG))
+#define reiserfs_attrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ATTRS))
 #define old_format_only(s) (REISERFS_SB(s)->s_properties & (1 << REISERFS_3_5))
 #define convert_reiserfs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_CONVERT))
 
author
#2 lore raw
Quoted 7 lines · Oleg Drokin
Quoted 2 lines · Tom Vier

is there a 2.5 attrs patch? i can't even list them in 2.5 on a reiserfs. i get "inappropriate ioctl for device".

See attached, I do not claim it will apply cleanly, though.
My tree have bunch of other reiserfs pending stuff that was not yet accepted by Linus.

i fixed it for 2.4.44-ac5 (minor change). lsattr and chattr now work properly, but +A has no effect. atime is still updated.

Signature · 2 lines
Tom Vier <[email protected]>
DSA Key ID 0xE6CB97DA
#3 lore raw

Hello!

Quoted 8 lines · Tom Vier
Quoted 6 lines · Tom Vier
Quoted 2 lines

is there a 2.5 attrs patch? i can't even list them in 2.5 on a reiserfs. i get "inappropriate ioctl for device".

See attached, I do not claim it will apply cleanly, though.
My tree have bunch of other reiserfs pending stuff that was not yet accepted by Linus.

i fixed it for 2.4.44-ac5 (minor change). lsattr and chattr now work properly, but +A has no effect. atime is still updated.

In order for attributes to work you need to mount the volume with -o attrs. Without that you can only get/set attributes value.

Bye,
Oleg

author
#4 lore raw
Quoted 2 lines · Oleg Drokin

In order for attributes to work you need to mount the volume with -o attrs. Without that you can only get/set attributes value.

i'm using the same /etc/fstab with attrs for 2.4 and it works. i haven't tried mounting another reiserfs, so i don't know if it's just the rootfs that's affected.

Signature · 2 lines
Tom Vier <[email protected]>
DSA Key ID 0xE6CB97DA
#5 lore raw

Hello!

Quoted 5 lines · Tom Vier
Quoted 2 lines

In order for attributes to work you need to mount the volume with -o attrs. Without that you can only get/set attributes value.

i'm using the same /etc/fstab with attrs for 2.4 and it works. i haven't tried mounting another reiserfs, so i don't know if it's just the rootfs that's affected.

Ah, so it's the rootfs, that explains. Patch for remounting options is not included in 2.5, see below for the patch.

Bye,
Oleg

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.664 -> 1.665
# fs/reiserfs/super.c 1.56 -> 1.57
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/02 [email protected] 1.665
# reiserfs: Allow for remount options to take effect.
# --------------------------------------------
#

fs/reiserfs/super.c +14 -0
diff -Nru a/fs/reiserfs/super.c b/fs/reiserfs/super.c
@@ -726,6 +726,20 @@
 
   if (!reiserfs_parse_options(s, arg, &mount_options, &blocks, NULL))
     return -EINVAL;
+
+#define SET_OPT( opt, bits, super )                                     \
+    if( ( bits ) & ( 1 << ( opt ) ) )                                   \
+            REISERFS_SB( super ) -> s_mount_opt |= ( 1 << ( opt ) )
+
+  /* set options in the super-block bitmask */
+  SET_OPT( REISERFS_LARGETAIL, mount_options, s );
+  SET_OPT( REISERFS_SMALLTAIL, mount_options, s );
+  SET_OPT( REISERFS_NO_BORDER, mount_options, s );
+  SET_OPT( REISERFS_NO_UNHASHED_RELOCATION, mount_options, s );
+  SET_OPT( REISERFS_HASHED_RELOCATION, mount_options, s );
+  SET_OPT( REISERFS_TEST4, mount_options, s );
+  SET_OPT( REISERFS_ATTRS, mount_options, s );
+#undef SET_OPT
   
   handle_attrs( s );