diff options
| author | Andrew Morton <akpm@digeo.com> | 2003-05-25 01:10:55 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-25 01:10:55 -0700 |
| commit | 37c90629bf0b13a9ca8b23d6a86eb2791fa8d57e (patch) | |
| tree | 2107f9f1ea7a10bf3432f700916c3ca123d4824a /include | |
| parent | 0c85cefd153a14cdd89a20e49ad8ca53c4b737ba (diff) | |
[PATCH] reiserfs: inode attributes support.
From: Oleg Drokin <green@namesys.com>
This is a forward port of 2.4's inode attributes support for reiserfs.
Original implementation for 2.4 was performed by Nikita Danilov.
In order to enable this support, one must use "attrs" mount options, eg:
mount /dev/hda1 /mount/pont -t reiserfs -o attrs
Also either the filesystem must have been created with a recent mkreiserfs
or must have been modified by a recent version of reiserfsck with its
"--clean-attributes" option.
If that is not done, attributes support will not be enabled and a kernel
message will be printed. This is necessary because old kernels left random
garbage in the place where these attributes now live.
These attributes are totally compatible with ext2's ones. You can
manipulate them with chattr/lsattr etc.
Additionally the chattr 'd' option may be used to disable tail packing on a
specific file or a directory tree. (The 'd' option normally means "don't
dump". reiserfs has overloaded it).
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/reiserfs_fs.h | 43 | ||||
| -rw-r--r-- | include/linux/reiserfs_fs_i.h | 3 | ||||
| -rw-r--r-- | include/linux/reiserfs_fs_sb.h | 5 |
3 files changed, 49 insertions, 2 deletions
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index fa5b3bdb0de6..319730b9ff5a 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h @@ -872,11 +872,41 @@ struct stat_data_v1 #define set_sd_v1_first_direct_byte(sdp,v) \ ((sdp)->sd_first_direct_byte = cpu_to_le32(v)) +#include <linux/ext2_fs.h> + +/* inode flags stored in sd_attrs (nee sd_reserved) */ + +/* we want common flags to have the same values as in ext2, + so chattr(1) will work without problems */ +#define REISERFS_IMMUTABLE_FL EXT2_IMMUTABLE_FL +#define REISERFS_SYNC_FL EXT2_SYNC_FL +#define REISERFS_NOATIME_FL EXT2_NOATIME_FL +#define REISERFS_NODUMP_FL EXT2_NODUMP_FL +#define REISERFS_SECRM_FL EXT2_SECRM_FL +#define REISERFS_UNRM_FL EXT2_UNRM_FL +#define REISERFS_COMPR_FL EXT2_COMPR_FL +/* persistent flag to disable tails on per-file basic. + Note, that is inheritable: mark directory with this and + all new files inside will not have tails. + + Teodore Tso allocated EXT2_NODUMP_FL (0x00008000) for this. Change + numeric constant to ext2 macro when available. */ +#define REISERFS_NOTAIL_FL (0x00008000) /* EXT2_NOTAIL_FL */ + +/* persistent flags that file inherits from the parent directory */ +#define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \ + REISERFS_SYNC_FL | \ + REISERFS_NOATIME_FL | \ + REISERFS_NODUMP_FL | \ + REISERFS_SECRM_FL | \ + REISERFS_COMPR_FL | \ + REISERFS_NOTAIL_FL ) + /* Stat Data on disk (reiserfs version of UFS disk inode minus the address blocks) */ struct stat_data { __u16 sd_mode; /* file type, permissions */ - __u16 sd_reserved; + __u16 sd_attrs; /* persistent inode flags */ __u32 sd_nlink; /* number of hard links */ __u64 sd_size; /* file size */ __u32 sd_uid; /* owner */ @@ -929,6 +959,8 @@ struct stat_data { #define set_sd_v2_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v)) #define sd_v2_generation(sdp) (le32_to_cpu((sdp)->u.sd_generation)) #define set_sd_v2_generation(sdp,v) ((sdp)->u.sd_generation = cpu_to_le32(v)) +#define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) +#define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) /***************************************************************************/ @@ -1871,6 +1903,9 @@ int reiserfs_new_inode (struct reiserfs_transaction_handle *th, int reiserfs_sync_inode (struct reiserfs_transaction_handle *th, struct inode * inode); void reiserfs_update_sd (struct reiserfs_transaction_handle *th, struct inode * inode); +void sd_attrs_to_i_attrs( __u16 sd_attrs, struct inode *inode ); +void i_attrs_to_sd_attrs( struct inode *inode, __u16 *sd_attrs ); + /* namei.c */ inline void set_de_name_and_namelen (struct reiserfs_dir_entry * de); int search_by_entry_key (struct super_block * sb, const struct cpu_key * key, @@ -2145,6 +2180,12 @@ int reiserfs_unpack (struct inode * inode, struct file * filp); /* ioctl's command */ #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) +/* define following flags to be the same as in ext2, so that chattr(1), + lsattr(1) will work with us. */ +#define REISERFS_IOC_GETFLAGS EXT2_IOC_GETFLAGS +#define REISERFS_IOC_SETFLAGS EXT2_IOC_SETFLAGS +#define REISERFS_IOC_GETVERSION EXT2_IOC_GETVERSION +#define REISERFS_IOC_SETVERSION EXT2_IOC_SETVERSION /* Locking primitives */ /* Right now we are still falling back to (un)lock_kernel, but eventually that diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h index 5c6b26b1d9b5..87e1b74e1125 100644 --- a/include/linux/reiserfs_fs_i.h +++ b/include/linux/reiserfs_fs_i.h @@ -32,6 +32,9 @@ struct reiserfs_inode_info { __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 diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 25eae6a8ece8..69342d6868fc 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h @@ -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 @@ -436,7 +439,6 @@ struct reiserfs_sb_info #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 @@ struct reiserfs_sb_info #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)) |
