diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/reiserfs_acl.h | 19 | ||||
-rw-r--r-- | include/linux/reiserfs_fs.h | 168 | ||||
-rw-r--r-- | include/linux/reiserfs_fs_i.h | 4 | ||||
-rw-r--r-- | include/linux/reiserfs_fs_sb.h | 31 | ||||
-rw-r--r-- | include/linux/reiserfs_xattr.h | 154 |
5 files changed, 192 insertions, 184 deletions
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h index fe00f781a622..52240e02de02 100644 --- a/include/linux/reiserfs_acl.h +++ b/include/linux/reiserfs_acl.h | |||
@@ -49,13 +49,12 @@ static inline int reiserfs_acl_count(size_t size) | |||
49 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | 49 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL |
50 | struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); | 50 | struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); |
51 | int reiserfs_acl_chmod(struct inode *inode); | 51 | int reiserfs_acl_chmod(struct inode *inode); |
52 | int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, | 52 | int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, |
53 | struct inode *dir, struct dentry *dentry, | ||
53 | struct inode *inode); | 54 | struct inode *inode); |
54 | int reiserfs_cache_default_acl(struct inode *dir); | 55 | int reiserfs_cache_default_acl(struct inode *dir); |
55 | extern int reiserfs_xattr_posix_acl_init(void) __init; | 56 | extern struct xattr_handler reiserfs_posix_acl_default_handler; |
56 | extern int reiserfs_xattr_posix_acl_exit(void); | 57 | extern struct xattr_handler reiserfs_posix_acl_access_handler; |
57 | extern struct reiserfs_xattr_handler posix_acl_default_handler; | ||
58 | extern struct reiserfs_xattr_handler posix_acl_access_handler; | ||
59 | 58 | ||
60 | static inline void reiserfs_init_acl_access(struct inode *inode) | 59 | static inline void reiserfs_init_acl_access(struct inode *inode) |
61 | { | 60 | { |
@@ -75,16 +74,6 @@ static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
75 | return NULL; | 74 | return NULL; |
76 | } | 75 | } |
77 | 76 | ||
78 | static inline int reiserfs_xattr_posix_acl_init(void) | ||
79 | { | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static inline int reiserfs_xattr_posix_acl_exit(void) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static inline int reiserfs_acl_chmod(struct inode *inode) | 77 | static inline int reiserfs_acl_chmod(struct inode *inode) |
89 | { | 78 | { |
90 | return 0; | 79 | return 0; |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index e356c99f0659..2245c78d5876 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -58,8 +58,6 @@ | |||
58 | #define reiserfs_write_lock( sb ) lock_kernel() | 58 | #define reiserfs_write_lock( sb ) lock_kernel() |
59 | #define reiserfs_write_unlock( sb ) unlock_kernel() | 59 | #define reiserfs_write_unlock( sb ) unlock_kernel() |
60 | 60 | ||
61 | /* xattr stuff */ | ||
62 | #define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) | ||
63 | struct fid; | 61 | struct fid; |
64 | 62 | ||
65 | /* in reading the #defines, it may help to understand that they employ | 63 | /* in reading the #defines, it may help to understand that they employ |
@@ -104,15 +102,21 @@ struct fid; | |||
104 | */ | 102 | */ |
105 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ | 103 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ |
106 | 104 | ||
107 | void reiserfs_warning(struct super_block *s, const char *fmt, ...); | 105 | void __reiserfs_warning(struct super_block *s, const char *id, |
106 | const char *func, const char *fmt, ...); | ||
107 | #define reiserfs_warning(s, id, fmt, args...) \ | ||
108 | __reiserfs_warning(s, id, __func__, fmt, ##args) | ||
108 | /* assertions handling */ | 109 | /* assertions handling */ |
109 | 110 | ||
110 | /** always check a condition and panic if it's false. */ | 111 | /** always check a condition and panic if it's false. */ |
111 | #define __RASSERT( cond, scond, format, args... ) \ | 112 | #define __RASSERT(cond, scond, format, args...) \ |
112 | if( !( cond ) ) \ | 113 | do { \ |
113 | reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ | 114 | if (!(cond)) \ |
114 | __FILE__ ":%i:%s: " format "\n", \ | 115 | reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \ |
115 | in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args ) | 116 | __FILE__ ":%i:%s: " format "\n", \ |
117 | in_interrupt() ? -1 : task_pid_nr(current), \ | ||
118 | __LINE__, __func__ , ##args); \ | ||
119 | } while (0) | ||
116 | 120 | ||
117 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) | 121 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) |
118 | 122 | ||
@@ -196,7 +200,11 @@ struct reiserfs_super_block { | |||
196 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ | 200 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ |
197 | unsigned char s_uuid[16]; /* filesystem unique identifier */ | 201 | unsigned char s_uuid[16]; /* filesystem unique identifier */ |
198 | unsigned char s_label[16]; /* filesystem volume label */ | 202 | unsigned char s_label[16]; /* filesystem volume label */ |
199 | char s_unused[88]; /* zero filled by mkreiserfs and | 203 | __le16 s_mnt_count; /* Count of mounts since last fsck */ |
204 | __le16 s_max_mnt_count; /* Maximum mounts before check */ | ||
205 | __le32 s_lastcheck; /* Timestamp of last fsck */ | ||
206 | __le32 s_check_interval; /* Interval between checks */ | ||
207 | char s_unused[76]; /* zero filled by mkreiserfs and | ||
200 | * reiserfs_convert_objectid_map_v1() | 208 | * reiserfs_convert_objectid_map_v1() |
201 | * so any additions must be updated | 209 | * so any additions must be updated |
202 | * there as well. */ | 210 | * there as well. */ |
@@ -578,10 +586,8 @@ static inline int uniqueness2type(__u32 uniqueness) | |||
578 | return TYPE_DIRECT; | 586 | return TYPE_DIRECT; |
579 | case V1_DIRENTRY_UNIQUENESS: | 587 | case V1_DIRENTRY_UNIQUENESS: |
580 | return TYPE_DIRENTRY; | 588 | return TYPE_DIRENTRY; |
581 | default: | ||
582 | reiserfs_warning(NULL, "vs-500: unknown uniqueness %d", | ||
583 | uniqueness); | ||
584 | case V1_ANY_UNIQUENESS: | 589 | case V1_ANY_UNIQUENESS: |
590 | default: | ||
585 | return TYPE_ANY; | 591 | return TYPE_ANY; |
586 | } | 592 | } |
587 | } | 593 | } |
@@ -598,9 +604,8 @@ static inline __u32 type2uniqueness(int type) | |||
598 | return V1_DIRECT_UNIQUENESS; | 604 | return V1_DIRECT_UNIQUENESS; |
599 | case TYPE_DIRENTRY: | 605 | case TYPE_DIRENTRY: |
600 | return V1_DIRENTRY_UNIQUENESS; | 606 | return V1_DIRENTRY_UNIQUENESS; |
601 | default: | ||
602 | reiserfs_warning(NULL, "vs-501: unknown type %d", type); | ||
603 | case TYPE_ANY: | 607 | case TYPE_ANY: |
608 | default: | ||
604 | return V1_ANY_UNIQUENESS; | 609 | return V1_ANY_UNIQUENESS; |
605 | } | 610 | } |
606 | } | 611 | } |
@@ -712,9 +717,9 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key) | |||
712 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) | 717 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) |
713 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) | 718 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) |
714 | 719 | ||
715 | #define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ | 720 | #define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \ |
716 | ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ | 721 | (!COMP_SHORT_KEYS(ih, key) && \ |
717 | I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) | 722 | I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize)) |
718 | 723 | ||
719 | /* maximal length of item */ | 724 | /* maximal length of item */ |
720 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) | 725 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) |
@@ -770,25 +775,25 @@ struct block_head { | |||
770 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ | 775 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ |
771 | 776 | ||
772 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ | 777 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ |
773 | #define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) | 778 | #define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data)) |
774 | /* Number of items that are in buffer. */ | 779 | /* Number of items that are in buffer. */ |
775 | #define B_NR_ITEMS(p_s_bh) (blkh_nr_item(B_BLK_HEAD(p_s_bh))) | 780 | #define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh))) |
776 | #define B_LEVEL(p_s_bh) (blkh_level(B_BLK_HEAD(p_s_bh))) | 781 | #define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh))) |
777 | #define B_FREE_SPACE(p_s_bh) (blkh_free_space(B_BLK_HEAD(p_s_bh))) | 782 | #define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh))) |
778 | 783 | ||
779 | #define PUT_B_NR_ITEMS(p_s_bh,val) do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0) | 784 | #define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0) |
780 | #define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) | 785 | #define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0) |
781 | #define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) | 786 | #define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0) |
782 | 787 | ||
783 | /* Get right delimiting key. -- little endian */ | 788 | /* Get right delimiting key. -- little endian */ |
784 | #define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)))) | 789 | #define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh)))) |
785 | 790 | ||
786 | /* Does the buffer contain a disk leaf. */ | 791 | /* Does the buffer contain a disk leaf. */ |
787 | #define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL) | 792 | #define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL) |
788 | 793 | ||
789 | /* Does the buffer contain a disk internal node */ | 794 | /* Does the buffer contain a disk internal node */ |
790 | #define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ | 795 | #define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \ |
791 | && B_LEVEL(p_s_bh) <= MAX_HEIGHT) | 796 | && B_LEVEL(bh) <= MAX_HEIGHT) |
792 | 797 | ||
793 | /***************************************************************************/ | 798 | /***************************************************************************/ |
794 | /* STAT DATA */ | 799 | /* STAT DATA */ |
@@ -1138,12 +1143,13 @@ struct disk_child { | |||
1138 | #define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) | 1143 | #define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) |
1139 | 1144 | ||
1140 | /* Get disk child by buffer header and position in the tree node. */ | 1145 | /* Get disk child by buffer header and position in the tree node. */ |
1141 | #define B_N_CHILD(p_s_bh,n_pos) ((struct disk_child *)\ | 1146 | #define B_N_CHILD(bh, n_pos) ((struct disk_child *)\ |
1142 | ((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos))) | 1147 | ((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos))) |
1143 | 1148 | ||
1144 | /* Get disk child number by buffer header and position in the tree node. */ | 1149 | /* Get disk child number by buffer header and position in the tree node. */ |
1145 | #define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) | 1150 | #define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos))) |
1146 | #define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) | 1151 | #define PUT_B_N_CHILD_NUM(bh, n_pos, val) \ |
1152 | (put_dc_block_number(B_N_CHILD(bh, n_pos), val)) | ||
1147 | 1153 | ||
1148 | /* maximal value of field child_size in structure disk_child */ | 1154 | /* maximal value of field child_size in structure disk_child */ |
1149 | /* child size is the combined size of all items and their headers */ | 1155 | /* child size is the combined size of all items and their headers */ |
@@ -1214,33 +1220,33 @@ struct treepath { | |||
1214 | struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | 1220 | struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} |
1215 | 1221 | ||
1216 | /* Get path element by path and path position. */ | 1222 | /* Get path element by path and path position. */ |
1217 | #define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset)) | 1223 | #define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset)) |
1218 | 1224 | ||
1219 | /* Get buffer header at the path by path and path position. */ | 1225 | /* Get buffer header at the path by path and path position. */ |
1220 | #define PATH_OFFSET_PBUFFER(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_buffer) | 1226 | #define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer) |
1221 | 1227 | ||
1222 | /* Get position in the element at the path by path and path position. */ | 1228 | /* Get position in the element at the path by path and path position. */ |
1223 | #define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) | 1229 | #define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position) |
1224 | 1230 | ||
1225 | #define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) | 1231 | #define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length)) |
1226 | /* you know, to the person who didn't | 1232 | /* you know, to the person who didn't |
1227 | write this the macro name does not | 1233 | write this the macro name does not |
1228 | at first suggest what it does. | 1234 | at first suggest what it does. |
1229 | Maybe POSITION_FROM_PATH_END? Or | 1235 | Maybe POSITION_FROM_PATH_END? Or |
1230 | maybe we should just focus on | 1236 | maybe we should just focus on |
1231 | dumping paths... -Hans */ | 1237 | dumping paths... -Hans */ |
1232 | #define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) | 1238 | #define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length)) |
1233 | 1239 | ||
1234 | #define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) | 1240 | #define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path)) |
1235 | 1241 | ||
1236 | /* in do_balance leaf has h == 0 in contrast with path structure, | 1242 | /* in do_balance leaf has h == 0 in contrast with path structure, |
1237 | where root has level == 0. That is why we need these defines */ | 1243 | where root has level == 0. That is why we need these defines */ |
1238 | #define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ | 1244 | #define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */ |
1239 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ | 1245 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ |
1240 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) | 1246 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) |
1241 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ | 1247 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ |
1242 | 1248 | ||
1243 | #define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) | 1249 | #define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h)) |
1244 | 1250 | ||
1245 | #define get_last_bh(path) PATH_PLAST_BUFFER(path) | 1251 | #define get_last_bh(path) PATH_PLAST_BUFFER(path) |
1246 | #define get_ih(path) PATH_PITEM_HEAD(path) | 1252 | #define get_ih(path) PATH_PITEM_HEAD(path) |
@@ -1470,6 +1476,16 @@ struct buffer_info { | |||
1470 | int bi_position; | 1476 | int bi_position; |
1471 | }; | 1477 | }; |
1472 | 1478 | ||
1479 | static inline struct super_block *sb_from_tb(struct tree_balance *tb) | ||
1480 | { | ||
1481 | return tb ? tb->tb_sb : NULL; | ||
1482 | } | ||
1483 | |||
1484 | static inline struct super_block *sb_from_bi(struct buffer_info *bi) | ||
1485 | { | ||
1486 | return bi ? sb_from_tb(bi->tb) : NULL; | ||
1487 | } | ||
1488 | |||
1473 | /* there are 4 types of items: stat data, directory item, indirect, direct. | 1489 | /* there are 4 types of items: stat data, directory item, indirect, direct. |
1474 | +-------------------+------------+--------------+------------+ | 1490 | +-------------------+------------+--------------+------------+ |
1475 | | | k_offset | k_uniqueness | mergeable? | | 1491 | | | k_offset | k_uniqueness | mergeable? | |
@@ -1520,7 +1536,7 @@ extern struct item_operations *item_ops[TYPE_ANY + 1]; | |||
1520 | #define COMP_SHORT_KEYS comp_short_keys | 1536 | #define COMP_SHORT_KEYS comp_short_keys |
1521 | 1537 | ||
1522 | /* number of blocks pointed to by the indirect item */ | 1538 | /* number of blocks pointed to by the indirect item */ |
1523 | #define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE ) | 1539 | #define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE) |
1524 | 1540 | ||
1525 | /* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ | 1541 | /* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ |
1526 | #define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) | 1542 | #define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) |
@@ -1623,6 +1639,10 @@ struct reiserfs_journal_header { | |||
1623 | #define JOURNAL_MAX_COMMIT_AGE 30 | 1639 | #define JOURNAL_MAX_COMMIT_AGE 30 |
1624 | #define JOURNAL_MAX_TRANS_AGE 30 | 1640 | #define JOURNAL_MAX_TRANS_AGE 30 |
1625 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | 1641 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) |
1642 | #define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \ | ||
1643 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \ | ||
1644 | REISERFS_QUOTA_TRANS_BLOCKS(sb))) | ||
1645 | |||
1626 | #ifdef CONFIG_QUOTA | 1646 | #ifdef CONFIG_QUOTA |
1627 | /* We need to update data and inode (atime) */ | 1647 | /* We need to update data and inode (atime) */ |
1628 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) | 1648 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) |
@@ -1697,7 +1717,7 @@ struct reiserfs_transaction_handle { | |||
1697 | int t_refcount; | 1717 | int t_refcount; |
1698 | int t_blocks_logged; /* number of blocks this writer has logged */ | 1718 | int t_blocks_logged; /* number of blocks this writer has logged */ |
1699 | int t_blocks_allocated; /* number of blocks this writer allocated */ | 1719 | int t_blocks_allocated; /* number of blocks this writer allocated */ |
1700 | unsigned long t_trans_id; /* sanity check, equals the current trans id */ | 1720 | unsigned int t_trans_id; /* sanity check, equals the current trans id */ |
1701 | void *t_handle_save; /* save existing current->journal_info */ | 1721 | void *t_handle_save; /* save existing current->journal_info */ |
1702 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block | 1722 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block |
1703 | should be displaced from others */ | 1723 | should be displaced from others */ |
@@ -1773,13 +1793,13 @@ int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, | |||
1773 | int journal_mark_freed(struct reiserfs_transaction_handle *, | 1793 | int journal_mark_freed(struct reiserfs_transaction_handle *, |
1774 | struct super_block *, b_blocknr_t blocknr); | 1794 | struct super_block *, b_blocknr_t blocknr); |
1775 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); | 1795 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); |
1776 | int reiserfs_in_journal(struct super_block *p_s_sb, unsigned int bmap_nr, | 1796 | int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr, |
1777 | int bit_nr, int searchall, b_blocknr_t *next); | 1797 | int bit_nr, int searchall, b_blocknr_t *next); |
1778 | int journal_begin(struct reiserfs_transaction_handle *, | 1798 | int journal_begin(struct reiserfs_transaction_handle *, |
1779 | struct super_block *p_s_sb, unsigned long); | 1799 | struct super_block *sb, unsigned long); |
1780 | int journal_join_abort(struct reiserfs_transaction_handle *, | 1800 | int journal_join_abort(struct reiserfs_transaction_handle *, |
1781 | struct super_block *p_s_sb, unsigned long); | 1801 | struct super_block *sb, unsigned long); |
1782 | void reiserfs_journal_abort(struct super_block *sb, int errno); | 1802 | void reiserfs_abort_journal(struct super_block *sb, int errno); |
1783 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); | 1803 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); |
1784 | int reiserfs_allocate_list_bitmaps(struct super_block *s, | 1804 | int reiserfs_allocate_list_bitmaps(struct super_block *s, |
1785 | struct reiserfs_list_bitmap *, unsigned int); | 1805 | struct reiserfs_list_bitmap *, unsigned int); |
@@ -1796,8 +1816,8 @@ int reiserfs_convert_objectid_map_v1(struct super_block *); | |||
1796 | 1816 | ||
1797 | /* stree.c */ | 1817 | /* stree.c */ |
1798 | int B_IS_IN_TREE(const struct buffer_head *); | 1818 | int B_IS_IN_TREE(const struct buffer_head *); |
1799 | extern void copy_item_head(struct item_head *p_v_to, | 1819 | extern void copy_item_head(struct item_head *to, |
1800 | const struct item_head *p_v_from); | 1820 | const struct item_head *from); |
1801 | 1821 | ||
1802 | // first key is in cpu form, second - le | 1822 | // first key is in cpu form, second - le |
1803 | extern int comp_short_keys(const struct reiserfs_key *le_key, | 1823 | extern int comp_short_keys(const struct reiserfs_key *le_key, |
@@ -1832,20 +1852,20 @@ static inline void copy_key(struct reiserfs_key *to, | |||
1832 | memcpy(to, from, KEY_SIZE); | 1852 | memcpy(to, from, KEY_SIZE); |
1833 | } | 1853 | } |
1834 | 1854 | ||
1835 | int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path); | 1855 | int comp_items(const struct item_head *stored_ih, const struct treepath *path); |
1836 | const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, | 1856 | const struct reiserfs_key *get_rkey(const struct treepath *chk_path, |
1837 | const struct super_block *p_s_sb); | 1857 | const struct super_block *sb); |
1838 | int search_by_key(struct super_block *, const struct cpu_key *, | 1858 | int search_by_key(struct super_block *, const struct cpu_key *, |
1839 | struct treepath *, int); | 1859 | struct treepath *, int); |
1840 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) | 1860 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) |
1841 | int search_for_position_by_key(struct super_block *p_s_sb, | 1861 | int search_for_position_by_key(struct super_block *sb, |
1842 | const struct cpu_key *p_s_cpu_key, | 1862 | const struct cpu_key *cpu_key, |
1843 | struct treepath *p_s_search_path); | 1863 | struct treepath *search_path); |
1844 | extern void decrement_bcount(struct buffer_head *p_s_bh); | 1864 | extern void decrement_bcount(struct buffer_head *bh); |
1845 | void decrement_counters_in_path(struct treepath *p_s_search_path); | 1865 | void decrement_counters_in_path(struct treepath *search_path); |
1846 | void pathrelse(struct treepath *p_s_search_path); | 1866 | void pathrelse(struct treepath *search_path); |
1847 | int reiserfs_check_path(struct treepath *p); | 1867 | int reiserfs_check_path(struct treepath *p); |
1848 | void pathrelse_and_restore(struct super_block *s, struct treepath *p_s_search_path); | 1868 | void pathrelse_and_restore(struct super_block *s, struct treepath *search_path); |
1849 | 1869 | ||
1850 | int reiserfs_insert_item(struct reiserfs_transaction_handle *th, | 1870 | int reiserfs_insert_item(struct reiserfs_transaction_handle *th, |
1851 | struct treepath *path, | 1871 | struct treepath *path, |
@@ -1868,14 +1888,14 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1868 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | 1888 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, |
1869 | struct treepath *path, | 1889 | struct treepath *path, |
1870 | const struct cpu_key *key, | 1890 | const struct cpu_key *key, |
1871 | struct inode *inode, struct buffer_head *p_s_un_bh); | 1891 | struct inode *inode, struct buffer_head *un_bh); |
1872 | 1892 | ||
1873 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, | 1893 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, |
1874 | struct inode *inode, struct reiserfs_key *key); | 1894 | struct inode *inode, struct reiserfs_key *key); |
1875 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, | 1895 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, |
1876 | struct inode *p_s_inode); | 1896 | struct inode *inode); |
1877 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, | 1897 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, |
1878 | struct inode *p_s_inode, struct page *, | 1898 | struct inode *inode, struct page *, |
1879 | int update_timestamps); | 1899 | int update_timestamps); |
1880 | 1900 | ||
1881 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) | 1901 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) |
@@ -1919,10 +1939,12 @@ void make_le_item_head(struct item_head *ih, const struct cpu_key *key, | |||
1919 | loff_t offset, int type, int length, int entry_count); | 1939 | loff_t offset, int type, int length, int entry_count); |
1920 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); | 1940 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); |
1921 | 1941 | ||
1942 | struct reiserfs_security_handle; | ||
1922 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | 1943 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, |
1923 | struct inode *dir, int mode, | 1944 | struct inode *dir, int mode, |
1924 | const char *symname, loff_t i_size, | 1945 | const char *symname, loff_t i_size, |
1925 | struct dentry *dentry, struct inode *inode); | 1946 | struct dentry *dentry, struct inode *inode, |
1947 | struct reiserfs_security_handle *security); | ||
1926 | 1948 | ||
1927 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, | 1949 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, |
1928 | struct inode *inode, loff_t size); | 1950 | struct inode *inode, loff_t size); |
@@ -1980,7 +2002,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset, | |||
1980 | #define PROC_INFO_MAX( sb, field, value ) VOID_V | 2002 | #define PROC_INFO_MAX( sb, field, value ) VOID_V |
1981 | #define PROC_INFO_INC( sb, field ) VOID_V | 2003 | #define PROC_INFO_INC( sb, field ) VOID_V |
1982 | #define PROC_INFO_ADD( sb, field, val ) VOID_V | 2004 | #define PROC_INFO_ADD( sb, field, val ) VOID_V |
1983 | #define PROC_INFO_BH_STAT( p_s_sb, p_s_bh, n_node_level ) VOID_V | 2005 | #define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V |
1984 | #endif | 2006 | #endif |
1985 | 2007 | ||
1986 | /* dir.c */ | 2008 | /* dir.c */ |
@@ -1988,6 +2010,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations; | |||
1988 | extern const struct inode_operations reiserfs_symlink_inode_operations; | 2010 | extern const struct inode_operations reiserfs_symlink_inode_operations; |
1989 | extern const struct inode_operations reiserfs_special_inode_operations; | 2011 | extern const struct inode_operations reiserfs_special_inode_operations; |
1990 | extern const struct file_operations reiserfs_dir_operations; | 2012 | extern const struct file_operations reiserfs_dir_operations; |
2013 | int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *); | ||
1991 | 2014 | ||
1992 | /* tail_conversion.c */ | 2015 | /* tail_conversion.c */ |
1993 | int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, | 2016 | int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, |
@@ -2004,13 +2027,20 @@ extern const struct address_space_operations reiserfs_address_space_operations; | |||
2004 | 2027 | ||
2005 | /* fix_nodes.c */ | 2028 | /* fix_nodes.c */ |
2006 | 2029 | ||
2007 | int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, | 2030 | int fix_nodes(int n_op_mode, struct tree_balance *tb, |
2008 | struct item_head *p_s_ins_ih, const void *); | 2031 | struct item_head *ins_ih, const void *); |
2009 | void unfix_nodes(struct tree_balance *); | 2032 | void unfix_nodes(struct tree_balance *); |
2010 | 2033 | ||
2011 | /* prints.c */ | 2034 | /* prints.c */ |
2012 | void reiserfs_panic(struct super_block *s, const char *fmt, ...) | 2035 | void __reiserfs_panic(struct super_block *s, const char *id, |
2036 | const char *function, const char *fmt, ...) | ||
2013 | __attribute__ ((noreturn)); | 2037 | __attribute__ ((noreturn)); |
2038 | #define reiserfs_panic(s, id, fmt, args...) \ | ||
2039 | __reiserfs_panic(s, id, __func__, fmt, ##args) | ||
2040 | void __reiserfs_error(struct super_block *s, const char *id, | ||
2041 | const char *function, const char *fmt, ...); | ||
2042 | #define reiserfs_error(s, id, fmt, args...) \ | ||
2043 | __reiserfs_error(s, id, __func__, fmt, ##args) | ||
2014 | void reiserfs_info(struct super_block *s, const char *fmt, ...); | 2044 | void reiserfs_info(struct super_block *s, const char *fmt, ...); |
2015 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); | 2045 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); |
2016 | void print_indirect_item(struct buffer_head *bh, int item_num); | 2046 | void print_indirect_item(struct buffer_head *bh, int item_num); |
@@ -2047,7 +2077,7 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num, | |||
2047 | int zeros_number); | 2077 | int zeros_number); |
2048 | void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, | 2078 | void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, |
2049 | int pos_in_item, int cut_size); | 2079 | int pos_in_item, int cut_size); |
2050 | void leaf_paste_entries(struct buffer_head *bh, int item_num, int before, | 2080 | void leaf_paste_entries(struct buffer_info *bi, int item_num, int before, |
2051 | int new_entry_count, struct reiserfs_de_head *new_dehs, | 2081 | int new_entry_count, struct reiserfs_de_head *new_dehs, |
2052 | const char *records, int paste_size); | 2082 | const char *records, int paste_size); |
2053 | /* ibalance.c */ | 2083 | /* ibalance.c */ |
@@ -2203,6 +2233,6 @@ long reiserfs_compat_ioctl(struct file *filp, | |||
2203 | unsigned int cmd, unsigned long arg); | 2233 | unsigned int cmd, unsigned long arg); |
2204 | int reiserfs_unpack(struct inode *inode, struct file *filp); | 2234 | int reiserfs_unpack(struct inode *inode, struct file *filp); |
2205 | 2235 | ||
2206 | |||
2207 | #endif /* __KERNEL__ */ | 2236 | #endif /* __KERNEL__ */ |
2237 | |||
2208 | #endif /* _LINUX_REISER_FS_H */ | 2238 | #endif /* _LINUX_REISER_FS_H */ |
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h index ce3663fb0101..76360b36ac33 100644 --- a/include/linux/reiserfs_fs_i.h +++ b/include/linux/reiserfs_fs_i.h | |||
@@ -51,7 +51,7 @@ struct reiserfs_inode_info { | |||
51 | /* we use these for fsync or O_SYNC to decide which transaction | 51 | /* we use these for fsync or O_SYNC to decide which transaction |
52 | ** needs to be committed in order for this inode to be properly | 52 | ** needs to be committed in order for this inode to be properly |
53 | ** flushed */ | 53 | ** flushed */ |
54 | unsigned long i_trans_id; | 54 | unsigned int i_trans_id; |
55 | struct reiserfs_journal_list *i_jl; | 55 | struct reiserfs_journal_list *i_jl; |
56 | struct mutex i_mmap; | 56 | struct mutex i_mmap; |
57 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | 57 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL |
@@ -59,7 +59,7 @@ struct reiserfs_inode_info { | |||
59 | struct posix_acl *i_acl_default; | 59 | struct posix_acl *i_acl_default; |
60 | #endif | 60 | #endif |
61 | #ifdef CONFIG_REISERFS_FS_XATTR | 61 | #ifdef CONFIG_REISERFS_FS_XATTR |
62 | struct rw_semaphore xattr_sem; | 62 | struct rw_semaphore i_xattr_sem; |
63 | #endif | 63 | #endif |
64 | struct inode vfs_inode; | 64 | struct inode vfs_inode; |
65 | }; | 65 | }; |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index bda6b562a1e0..5621d87c4479 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -14,7 +14,7 @@ typedef enum { | |||
14 | } reiserfs_super_block_flags; | 14 | } reiserfs_super_block_flags; |
15 | 15 | ||
16 | /* struct reiserfs_super_block accessors/mutators | 16 | /* struct reiserfs_super_block accessors/mutators |
17 | * since this is a disk structure, it will always be in | 17 | * since this is a disk structure, it will always be in |
18 | * little endian format. */ | 18 | * little endian format. */ |
19 | #define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) | 19 | #define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) |
20 | #define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) | 20 | #define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) |
@@ -73,6 +73,9 @@ typedef enum { | |||
73 | #define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) | 73 | #define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) |
74 | #define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) | 74 | #define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) |
75 | 75 | ||
76 | #define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count)) | ||
77 | #define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v)) | ||
78 | |||
76 | #define sb_reserved_for_journal(sbp) \ | 79 | #define sb_reserved_for_journal(sbp) \ |
77 | (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) | 80 | (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) |
78 | #define set_sb_reserved_for_journal(sbp,v) \ | 81 | #define set_sb_reserved_for_journal(sbp,v) \ |
@@ -80,16 +83,16 @@ typedef enum { | |||
80 | 83 | ||
81 | /* LOGGING -- */ | 84 | /* LOGGING -- */ |
82 | 85 | ||
83 | /* These all interelate for performance. | 86 | /* These all interelate for performance. |
84 | ** | 87 | ** |
85 | ** If the journal block count is smaller than n transactions, you lose speed. | 88 | ** If the journal block count is smaller than n transactions, you lose speed. |
86 | ** I don't know what n is yet, I'm guessing 8-16. | 89 | ** I don't know what n is yet, I'm guessing 8-16. |
87 | ** | 90 | ** |
88 | ** typical transaction size depends on the application, how often fsync is | 91 | ** typical transaction size depends on the application, how often fsync is |
89 | ** called, and how many metadata blocks you dirty in a 30 second period. | 92 | ** called, and how many metadata blocks you dirty in a 30 second period. |
90 | ** The more small files (<16k) you use, the larger your transactions will | 93 | ** The more small files (<16k) you use, the larger your transactions will |
91 | ** be. | 94 | ** be. |
92 | ** | 95 | ** |
93 | ** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal | 96 | ** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal |
94 | ** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough | 97 | ** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough |
95 | ** to prevent wrapping before dirty meta blocks get to disk. | 98 | ** to prevent wrapping before dirty meta blocks get to disk. |
@@ -153,7 +156,7 @@ struct reiserfs_journal_list { | |||
153 | atomic_t j_commit_left; | 156 | atomic_t j_commit_left; |
154 | atomic_t j_older_commits_done; /* all commits older than this on disk */ | 157 | atomic_t j_older_commits_done; /* all commits older than this on disk */ |
155 | struct mutex j_commit_mutex; | 158 | struct mutex j_commit_mutex; |
156 | unsigned long j_trans_id; | 159 | unsigned int j_trans_id; |
157 | time_t j_timestamp; | 160 | time_t j_timestamp; |
158 | struct reiserfs_list_bitmap *j_list_bitmap; | 161 | struct reiserfs_list_bitmap *j_list_bitmap; |
159 | struct buffer_head *j_commit_bh; /* commit buffer head */ | 162 | struct buffer_head *j_commit_bh; /* commit buffer head */ |
@@ -182,7 +185,7 @@ struct reiserfs_journal { | |||
182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | 185 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ |
183 | 186 | ||
184 | unsigned long j_state; | 187 | unsigned long j_state; |
185 | unsigned long j_trans_id; | 188 | unsigned int j_trans_id; |
186 | unsigned long j_mount_id; | 189 | unsigned long j_mount_id; |
187 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ | 190 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ |
188 | unsigned long j_len; /* length of current waiting commit */ | 191 | unsigned long j_len; /* length of current waiting commit */ |
@@ -223,10 +226,10 @@ struct reiserfs_journal { | |||
223 | int j_num_work_lists; /* number that need attention from kreiserfsd */ | 226 | int j_num_work_lists; /* number that need attention from kreiserfsd */ |
224 | 227 | ||
225 | /* debugging to make sure things are flushed in order */ | 228 | /* debugging to make sure things are flushed in order */ |
226 | int j_last_flush_id; | 229 | unsigned int j_last_flush_id; |
227 | 230 | ||
228 | /* debugging to make sure things are committed in order */ | 231 | /* debugging to make sure things are committed in order */ |
229 | int j_last_commit_id; | 232 | unsigned int j_last_commit_id; |
230 | 233 | ||
231 | struct list_head j_bitmap_nodes; | 234 | struct list_head j_bitmap_nodes; |
232 | struct list_head j_dirty_buffers; | 235 | struct list_head j_dirty_buffers; |
@@ -239,7 +242,7 @@ struct reiserfs_journal { | |||
239 | 242 | ||
240 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ | 243 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ |
241 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ | 244 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ |
242 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all | 245 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all |
243 | the transactions */ | 246 | the transactions */ |
244 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ | 247 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ |
245 | int j_persistent_trans; | 248 | int j_persistent_trans; |
@@ -399,10 +402,7 @@ struct reiserfs_sb_info { | |||
399 | int reserved_blocks; /* amount of blocks reserved for further allocations */ | 402 | int reserved_blocks; /* amount of blocks reserved for further allocations */ |
400 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | 403 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ |
401 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | 404 | struct dentry *priv_root; /* root of /.reiserfs_priv */ |
402 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
403 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ | 405 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ |
404 | struct rw_semaphore xattr_dir_sem; | ||
405 | #endif | ||
406 | int j_errno; | 406 | int j_errno; |
407 | #ifdef CONFIG_QUOTA | 407 | #ifdef CONFIG_QUOTA |
408 | char *s_qf_names[MAXQUOTAS]; | 408 | char *s_qf_names[MAXQUOTAS]; |
@@ -426,7 +426,7 @@ enum reiserfs_mount_options { | |||
426 | partition will be dealt with in a | 426 | partition will be dealt with in a |
427 | manner of 3.5.x */ | 427 | manner of 3.5.x */ |
428 | 428 | ||
429 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting | 429 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting |
430 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option | 430 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option |
431 | ** is not required. If the normal autodection code can't determine which | 431 | ** is not required. If the normal autodection code can't determine which |
432 | ** hash to use (because both hashes had the same value for a file) | 432 | ** hash to use (because both hashes had the same value for a file) |
@@ -451,7 +451,6 @@ enum reiserfs_mount_options { | |||
451 | REISERFS_NO_UNHASHED_RELOCATION, | 451 | REISERFS_NO_UNHASHED_RELOCATION, |
452 | REISERFS_HASHED_RELOCATION, | 452 | REISERFS_HASHED_RELOCATION, |
453 | REISERFS_ATTRS, | 453 | REISERFS_ATTRS, |
454 | REISERFS_XATTRS, | ||
455 | REISERFS_XATTRS_USER, | 454 | REISERFS_XATTRS_USER, |
456 | REISERFS_POSIXACL, | 455 | REISERFS_POSIXACL, |
457 | REISERFS_BARRIER_NONE, | 456 | REISERFS_BARRIER_NONE, |
@@ -489,7 +488,7 @@ enum reiserfs_mount_options { | |||
489 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) | 488 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) |
490 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) | 489 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) |
491 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) | 490 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) |
492 | #define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS)) | 491 | #define reiserfs_xattrs(s) ((s)->s_xattr != NULL) |
493 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) | 492 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) |
494 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) | 493 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) |
495 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) | 494 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index af135ae895db..dcae01e63e40 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -15,6 +15,12 @@ struct reiserfs_xattr_header { | |||
15 | __le32 h_hash; /* hash of the value */ | 15 | __le32 h_hash; /* hash of the value */ |
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct reiserfs_security_handle { | ||
19 | char *name; | ||
20 | void *value; | ||
21 | size_t length; | ||
22 | }; | ||
23 | |||
18 | #ifdef __KERNEL__ | 24 | #ifdef __KERNEL__ |
19 | 25 | ||
20 | #include <linux/init.h> | 26 | #include <linux/init.h> |
@@ -29,22 +35,13 @@ struct iattr; | |||
29 | struct super_block; | 35 | struct super_block; |
30 | struct nameidata; | 36 | struct nameidata; |
31 | 37 | ||
32 | struct reiserfs_xattr_handler { | 38 | int reiserfs_xattr_register_handlers(void) __init; |
33 | char *prefix; | 39 | void reiserfs_xattr_unregister_handlers(void); |
34 | int (*init) (void); | 40 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); |
35 | void (*exit) (void); | 41 | int reiserfs_delete_xattrs(struct inode *inode); |
36 | int (*get) (struct inode * inode, const char *name, void *buffer, | 42 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); |
37 | size_t size); | ||
38 | int (*set) (struct inode * inode, const char *name, const void *buffer, | ||
39 | size_t size, int flags); | ||
40 | int (*del) (struct inode * inode, const char *name); | ||
41 | int (*list) (struct inode * inode, const char *name, int namelen, | ||
42 | char *out); | ||
43 | struct list_head handlers; | ||
44 | }; | ||
45 | 43 | ||
46 | #ifdef CONFIG_REISERFS_FS_XATTR | 44 | #ifdef CONFIG_REISERFS_FS_XATTR |
47 | #define is_reiserfs_priv_object(inode) IS_PRIVATE(inode) | ||
48 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) | 45 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) |
49 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, | 46 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, |
50 | void *buffer, size_t size); | 47 | void *buffer, size_t size); |
@@ -52,104 +49,97 @@ int reiserfs_setxattr(struct dentry *dentry, const char *name, | |||
52 | const void *value, size_t size, int flags); | 49 | const void *value, size_t size, int flags); |
53 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | 50 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); |
54 | int reiserfs_removexattr(struct dentry *dentry, const char *name); | 51 | int reiserfs_removexattr(struct dentry *dentry, const char *name); |
55 | int reiserfs_delete_xattrs(struct inode *inode); | ||
56 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | ||
57 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | ||
58 | int reiserfs_permission(struct inode *inode, int mask); | 52 | int reiserfs_permission(struct inode *inode, int mask); |
59 | 53 | ||
60 | int reiserfs_xattr_del(struct inode *, const char *); | 54 | int reiserfs_xattr_get(struct inode *, const char *, void *, size_t); |
61 | int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); | ||
62 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); | 55 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); |
63 | 56 | int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *, | |
64 | extern struct reiserfs_xattr_handler user_handler; | 57 | struct inode *, const char *, const void *, |
65 | extern struct reiserfs_xattr_handler trusted_handler; | 58 | size_t, int); |
66 | extern struct reiserfs_xattr_handler security_handler; | 59 | |
67 | 60 | extern struct xattr_handler reiserfs_xattr_user_handler; | |
68 | int reiserfs_xattr_register_handlers(void) __init; | 61 | extern struct xattr_handler reiserfs_xattr_trusted_handler; |
69 | void reiserfs_xattr_unregister_handlers(void); | 62 | extern struct xattr_handler reiserfs_xattr_security_handler; |
70 | 63 | #ifdef CONFIG_REISERFS_FS_SECURITY | |
71 | static inline void reiserfs_write_lock_xattrs(struct super_block *sb) | 64 | int reiserfs_security_init(struct inode *dir, struct inode *inode, |
72 | { | 65 | struct reiserfs_security_handle *sec); |
73 | down_write(&REISERFS_XATTR_DIR_SEM(sb)); | 66 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, |
74 | } | 67 | struct inode *inode, |
75 | static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) | 68 | struct reiserfs_security_handle *sec); |
76 | { | 69 | void reiserfs_security_free(struct reiserfs_security_handle *sec); |
77 | up_write(&REISERFS_XATTR_DIR_SEM(sb)); | 70 | #endif |
78 | } | 71 | |
79 | static inline void reiserfs_read_lock_xattrs(struct super_block *sb) | 72 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) |
80 | { | 73 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) |
81 | down_read(&REISERFS_XATTR_DIR_SEM(sb)); | ||
82 | } | ||
83 | |||
84 | static inline void reiserfs_read_unlock_xattrs(struct super_block *sb) | ||
85 | { | 74 | { |
86 | up_read(&REISERFS_XATTR_DIR_SEM(sb)); | 75 | loff_t ret = 0; |
76 | if (reiserfs_file_data_log(inode)) { | ||
77 | ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize); | ||
78 | ret >>= inode->i_sb->s_blocksize_bits; | ||
79 | } | ||
80 | return ret; | ||
87 | } | 81 | } |
88 | 82 | ||
89 | static inline void reiserfs_write_lock_xattr_i(struct inode *inode) | 83 | /* We may have to create up to 3 objects: xattr root, xattr dir, xattr file. |
90 | { | 84 | * Let's try to be smart about it. |
91 | down_write(&REISERFS_I(inode)->xattr_sem); | 85 | * xattr root: We cache it. If it's not cached, we may need to create it. |
92 | } | 86 | * xattr dir: If anything has been loaded for this inode, we can set a flag |
93 | static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) | 87 | * saying so. |
88 | * xattr file: Since we don't cache xattrs, we can't tell. We always include | ||
89 | * blocks for it. | ||
90 | * | ||
91 | * However, since root and dir can be created between calls - YOU MUST SAVE | ||
92 | * THIS VALUE. | ||
93 | */ | ||
94 | static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | ||
94 | { | 95 | { |
95 | up_write(&REISERFS_I(inode)->xattr_sem); | 96 | size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
96 | } | ||
97 | static inline void reiserfs_read_lock_xattr_i(struct inode *inode) | ||
98 | { | ||
99 | down_read(&REISERFS_I(inode)->xattr_sem); | ||
100 | } | ||
101 | 97 | ||
102 | static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) | 98 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { |
103 | { | 99 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
104 | up_read(&REISERFS_I(inode)->xattr_sem); | 100 | if (REISERFS_SB(inode->i_sb)->xattr_root == NULL) |
105 | } | 101 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
102 | } | ||
106 | 103 | ||
107 | static inline void reiserfs_mark_inode_private(struct inode *inode) | 104 | return nblocks; |
108 | { | ||
109 | inode->i_flags |= S_PRIVATE; | ||
110 | } | 105 | } |
111 | 106 | ||
112 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | 107 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) |
113 | { | 108 | { |
114 | init_rwsem(&REISERFS_I(inode)->xattr_sem); | 109 | init_rwsem(&REISERFS_I(inode)->i_xattr_sem); |
115 | } | 110 | } |
116 | 111 | ||
117 | #else | 112 | #else |
118 | 113 | ||
119 | #define is_reiserfs_priv_object(inode) 0 | ||
120 | #define reiserfs_mark_inode_private(inode) do {;} while(0) | ||
121 | #define reiserfs_getxattr NULL | 114 | #define reiserfs_getxattr NULL |
122 | #define reiserfs_setxattr NULL | 115 | #define reiserfs_setxattr NULL |
123 | #define reiserfs_listxattr NULL | 116 | #define reiserfs_listxattr NULL |
124 | #define reiserfs_removexattr NULL | 117 | #define reiserfs_removexattr NULL |
125 | #define reiserfs_write_lock_xattrs(sb) do {;} while(0) | ||
126 | #define reiserfs_write_unlock_xattrs(sb) do {;} while(0) | ||
127 | #define reiserfs_read_lock_xattrs(sb) | ||
128 | #define reiserfs_read_unlock_xattrs(sb) | ||
129 | 118 | ||
130 | #define reiserfs_permission NULL | 119 | #define reiserfs_permission NULL |
131 | 120 | ||
132 | #define reiserfs_xattr_register_handlers() 0 | 121 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) |
133 | #define reiserfs_xattr_unregister_handlers() | ||
134 | |||
135 | static inline int reiserfs_delete_xattrs(struct inode *inode) | ||
136 | { | 122 | { |
137 | return 0; | 123 | } |
138 | }; | 124 | #endif /* CONFIG_REISERFS_FS_XATTR */ |
139 | static inline int reiserfs_chown_xattrs(struct inode *inode, | 125 | |
140 | struct iattr *attrs) | 126 | #ifndef CONFIG_REISERFS_FS_SECURITY |
127 | static inline int reiserfs_security_init(struct inode *dir, | ||
128 | struct inode *inode, | ||
129 | struct reiserfs_security_handle *sec) | ||
141 | { | 130 | { |
142 | return 0; | 131 | return 0; |
143 | }; | 132 | } |
144 | static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags) | 133 | static inline int |
134 | reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
135 | struct inode *inode, | ||
136 | struct reiserfs_security_handle *sec) | ||
145 | { | 137 | { |
146 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ | ||
147 | return 0; | 138 | return 0; |
148 | }; | ||
149 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
150 | { | ||
151 | } | 139 | } |
152 | #endif /* CONFIG_REISERFS_FS_XATTR */ | 140 | static inline void reiserfs_security_free(struct reiserfs_security_handle *sec) |
141 | {} | ||
142 | #endif | ||
153 | 143 | ||
154 | #endif /* __KERNEL__ */ | 144 | #endif /* __KERNEL__ */ |
155 | 145 | ||