ReiserFS additional inode attributes support for 2.5.51
PATCH 1/1 ReiserFS additional inode attributes support for 2.5.51
This adds such things as the immutable attribute to reiserfs, thereby making ReiserFS more conformant to the Linux (or at least ext2) norm.
Hello!
These two changesets implement ext2 compatible extended inode attributes in reiserfs (the ones visible to lsattr(1) and friends). Second changeset also allows for some mount options to take effect on remount.
Both changesets are forwardports from 2.4. Original work was performed by Nikita Danilov.
You can pull these from bk://thebsh.namesys.com/bk/reiser3-linux-2.5-iattrs
[email protected], 2002-12-07 14:29:56+03:00, [email protected]
reiserfs: Allow for remount options to take effect.
[email protected], 2002-12-07 14:26:28+03:00, [email protected]
reiserfs: Extended inode attributes support
Diffstat:
fs/reiserfs/dir.c | 1 fs/reiserfs/inode.c | 73 ++++++++++++++++++++++++++++++++++++----- fs/reiserfs/ioctl.c | 62 ++++++++++++++++++++++++++++++++-- fs/reiserfs/procfs.c | 6 +++ fs/reiserfs/super.c | 36 ++++++++++++++++++++ include/linux/reiserfs_fs.h | 43 +++++++++++++++++++++++- include/linux/reiserfs_fs_i.h | 3 + include/linux/reiserfs_fs_sb.h | 5 ++ 8 files changed, 215 insertions(+), 14 deletions(-)
Plain text patch:
# 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.844 -> 1.846 # fs/reiserfs/procfs.c 1.14 -> 1.15 # fs/reiserfs/inode.c 1.68 -> 1.69 # fs/reiserfs/ioctl.c 1.10 -> 1.11 # fs/reiserfs/super.c 1.54 -> 1.56
# include/linux/reiserfs_fs_sb.h 1.20 -> 1.21
# fs/reiserfs/dir.c 1.17 -> 1.18
# include/linux/reiserfs_fs_i.h 1.7 -> 1.8
# include/linux/reiserfs_fs.h 1.45 -> 1.46
#
# The following is the BitKeeper ChangeSet Log # --------------------------------------------
# 02/12/07 [email protected] 1.845
# reiserfs: Extended inode attributes support # --------------------------------------------
# 02/12/07 [email protected] 1.846
# reiserfs: Allow for remount options to take effect. # -------------------------------------------- #
fs/reiserfs/dir.c +1 -0
@@ -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
@@ -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 +36 -0
@@ -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;
@@ -708,7 +726,23 @@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 ); +if (blocks) {int rc =reiserfs_resize (s, blocks);if (rc !=0 )
@@ -1303,6 +1337,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
@@ -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
@@ -8,6 +8,9 @@#include <linux/workqueue.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
@@ -435,7 +438,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
@@ -457,6 +459,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))