]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/reiserfs_fs.h
reiserfs: rename p_s_bh to bh
[linux-2.6-omap-h63xx.git] / include / linux / reiserfs_fs.h
index bc5114d35e99b65db4e11acefe3bae623a7c9db9..9cfa518c90b6031008725390bc7b19e86c38491a 100644 (file)
@@ -79,15 +79,21 @@ struct fid;
 */
 #define REISERFS_DEBUG_CODE 5  /* extra messages to help find/debug errors */
 
-void reiserfs_warning(struct super_block *s, const char *fmt, ...);
+void __reiserfs_warning(struct super_block *s, const char *id,
+                        const char *func, const char *fmt, ...);
+#define reiserfs_warning(s, id, fmt, args...) \
+        __reiserfs_warning(s, id, __func__, fmt, ##args)
 /* assertions handling */
 
 /** always check a condition and panic if it's false. */
-#define __RASSERT( cond, scond, format, args... )                                      \
-if( !( cond ) )                                                                \
-  reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
-                 __FILE__ ":%i:%s: " format "\n",              \
-                 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args )
+#define __RASSERT(cond, scond, format, args...)                        \
+do {                                                                   \
+       if (!(cond))                                                    \
+               reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \
+                              __FILE__ ":%i:%s: " format "\n",         \
+                              in_interrupt() ? -1 : task_pid_nr(current), \
+                              __LINE__, __func__ , ##args);            \
+} while (0)
 
 #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
 
@@ -171,7 +177,11 @@ struct reiserfs_super_block {
        __le32 s_flags;         /* Right now used only by inode-attributes, if enabled */
        unsigned char s_uuid[16];       /* filesystem unique identifier */
        unsigned char s_label[16];      /* filesystem volume label */
-       char s_unused[88];      /* zero filled by mkreiserfs and
+       __le16 s_mnt_count;             /* Count of mounts since last fsck */
+       __le16 s_max_mnt_count;         /* Maximum mounts before check */
+       __le32 s_lastcheck;             /* Timestamp of last fsck */
+       __le32 s_check_interval;        /* Interval between checks */
+       char s_unused[76];      /* zero filled by mkreiserfs and
                                 * reiserfs_convert_objectid_map_v1()
                                 * so any additions must be updated
                                 * there as well. */
@@ -553,10 +563,8 @@ static inline int uniqueness2type(__u32 uniqueness)
                return TYPE_DIRECT;
        case V1_DIRENTRY_UNIQUENESS:
                return TYPE_DIRENTRY;
-       default:
-               reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
-                                uniqueness);
        case V1_ANY_UNIQUENESS:
+       default:
                return TYPE_ANY;
        }
 }
@@ -573,9 +581,8 @@ static inline __u32 type2uniqueness(int type)
                return V1_DIRECT_UNIQUENESS;
        case TYPE_DIRENTRY:
                return V1_DIRENTRY_UNIQUENESS;
-       default:
-               reiserfs_warning(NULL, "vs-501: unknown type %d", type);
        case TYPE_ANY:
+       default:
                return V1_ANY_UNIQUENESS;
        }
 }
@@ -744,25 +751,25 @@ struct block_head {
 #define DISK_LEAF_NODE_LEVEL  1        /* Leaf node level. */
 
 /* Given the buffer head of a formatted node, resolve to the block head of that node. */
-#define B_BLK_HEAD(p_s_bh)            ((struct block_head *)((p_s_bh)->b_data))
+#define B_BLK_HEAD(bh)                 ((struct block_head *)((bh)->b_data))
 /* Number of items that are in buffer. */
-#define B_NR_ITEMS(p_s_bh)            (blkh_nr_item(B_BLK_HEAD(p_s_bh)))
-#define B_LEVEL(p_s_bh)               (blkh_level(B_BLK_HEAD(p_s_bh)))
-#define B_FREE_SPACE(p_s_bh)          (blkh_free_space(B_BLK_HEAD(p_s_bh)))
+#define B_NR_ITEMS(bh)                 (blkh_nr_item(B_BLK_HEAD(bh)))
+#define B_LEVEL(bh)                    (blkh_level(B_BLK_HEAD(bh)))
+#define B_FREE_SPACE(bh)               (blkh_free_space(B_BLK_HEAD(bh)))
 
-#define PUT_B_NR_ITEMS(p_s_bh,val)    do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0)
-#define PUT_B_LEVEL(p_s_bh,val)       do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0)
-#define PUT_B_FREE_SPACE(p_s_bh,val)  do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0)
+#define PUT_B_NR_ITEMS(bh, val)                do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0)
+#define PUT_B_LEVEL(bh, val)           do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0)
+#define PUT_B_FREE_SPACE(bh, val)      do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0)
 
 /* Get right delimiting key. -- little endian */
-#define B_PRIGHT_DELIM_KEY(p_s_bh)   (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh))))
+#define B_PRIGHT_DELIM_KEY(bh)         (&(blk_right_delim_key(B_BLK_HEAD(bh))))
 
 /* Does the buffer contain a disk leaf. */
-#define B_IS_ITEMS_LEVEL(p_s_bh)     (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL)
+#define B_IS_ITEMS_LEVEL(bh)           (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL)
 
 /* Does the buffer contain a disk internal node */
-#define B_IS_KEYS_LEVEL(p_s_bh)      (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \
-                                            && B_LEVEL(p_s_bh) <= MAX_HEIGHT)
+#define B_IS_KEYS_LEVEL(bh)      (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \
+                                           && B_LEVEL(bh) <= MAX_HEIGHT)
 
 /***************************************************************************/
 /*                             STAT DATA                                   */
@@ -1112,12 +1119,13 @@ struct disk_child {
 #define put_dc_size(dc_p, val)   do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
 
 /* Get disk child by buffer header and position in the tree node. */
-#define B_N_CHILD(p_s_bh,n_pos)  ((struct disk_child *)\
-((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos)))
+#define B_N_CHILD(bh, n_pos)  ((struct disk_child *)\
+((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos)))
 
 /* Get disk child number by buffer header and position in the tree node. */
-#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos)))
-#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 ))
+#define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos)))
+#define PUT_B_N_CHILD_NUM(bh, n_pos, val) \
+                               (put_dc_block_number(B_N_CHILD(bh, n_pos), val))
 
  /* maximal value of field child_size in structure disk_child */
  /* child size is the combined size of all items and their headers */
@@ -1444,6 +1452,16 @@ struct buffer_info {
        int bi_position;
 };
 
+static inline struct super_block *sb_from_tb(struct tree_balance *tb)
+{
+       return tb ? tb->tb_sb : NULL;
+}
+
+static inline struct super_block *sb_from_bi(struct buffer_info *bi)
+{
+       return bi ? sb_from_tb(bi->tb) : NULL;
+}
+
 /* there are 4 types of items: stat data, directory item, indirect, direct.
 +-------------------+------------+--------------+------------+
 |                  |  k_offset  | k_uniqueness | mergeable? |
@@ -1598,6 +1616,10 @@ struct reiserfs_journal_header {
 #define JOURNAL_MAX_COMMIT_AGE 30
 #define JOURNAL_MAX_TRANS_AGE 30
 #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
+#define JOURNAL_BLOCKS_PER_OBJECT(sb)  (JOURNAL_PER_BALANCE_CNT * 3 + \
+                                        2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \
+                                             REISERFS_QUOTA_TRANS_BLOCKS(sb)))
+
 #ifdef CONFIG_QUOTA
 /* We need to update data and inode (atime) */
 #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0)
@@ -1672,7 +1694,7 @@ struct reiserfs_transaction_handle {
        int t_refcount;
        int t_blocks_logged;    /* number of blocks this writer has logged */
        int t_blocks_allocated; /* number of blocks this writer allocated */
-       unsigned long t_trans_id;       /* sanity check, equals the current trans id */
+       unsigned int t_trans_id;        /* sanity check, equals the current trans id */
        void *t_handle_save;    /* save existing current->journal_info */
        unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
                                           should be displaced from others */
@@ -1748,13 +1770,13 @@ int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
 int journal_mark_freed(struct reiserfs_transaction_handle *,
                       struct super_block *, b_blocknr_t blocknr);
 int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
-int reiserfs_in_journal(struct super_block *p_s_sb, unsigned int bmap_nr,
-                       int bit_nr, int searchall, b_blocknr_t *next);
+int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr,
+                        int bit_nr, int searchall, b_blocknr_t *next);
 int journal_begin(struct reiserfs_transaction_handle *,
-                 struct super_block *p_s_sb, unsigned long);
+                 struct super_block *sb, unsigned long);
 int journal_join_abort(struct reiserfs_transaction_handle *,
-                      struct super_block *p_s_sb, unsigned long);
-void reiserfs_journal_abort(struct super_block *sb, int errno);
+                      struct super_block *sb, unsigned long);
+void reiserfs_abort_journal(struct super_block *sb, int errno);
 void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
 int reiserfs_allocate_list_bitmaps(struct super_block *s,
                                   struct reiserfs_list_bitmap *, unsigned int);
@@ -1809,14 +1831,14 @@ static inline void copy_key(struct reiserfs_key *to,
 
 int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path);
 const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path,
-                                   const struct super_block *p_s_sb);
+                                   const struct super_block *sb);
 int search_by_key(struct super_block *, const struct cpu_key *,
                  struct treepath *, int);
 #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
-int search_for_position_by_key(struct super_block *p_s_sb,
+int search_for_position_by_key(struct super_block *sb,
                               const struct cpu_key *p_s_cpu_key,
                               struct treepath *p_s_search_path);
-extern void decrement_bcount(struct buffer_head *p_s_bh);
+extern void decrement_bcount(struct buffer_head *bh);
 void decrement_counters_in_path(struct treepath *p_s_search_path);
 void pathrelse(struct treepath *p_s_search_path);
 int reiserfs_check_path(struct treepath *p);
@@ -1894,10 +1916,12 @@ void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
                       loff_t offset, int type, int length, int entry_count);
 struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
 
+struct reiserfs_security_handle;
 int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
                       struct inode *dir, int mode,
                       const char *symname, loff_t i_size,
-                      struct dentry *dentry, struct inode *inode);
+                      struct dentry *dentry, struct inode *inode,
+                      struct reiserfs_security_handle *security);
 
 void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
                             struct inode *inode, loff_t size);
@@ -1955,7 +1979,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
 #define PROC_INFO_MAX( sb, field, value ) VOID_V
 #define PROC_INFO_INC( sb, field ) VOID_V
 #define PROC_INFO_ADD( sb, field, val ) VOID_V
-#define PROC_INFO_BH_STAT( p_s_sb, p_s_bh, n_node_level ) VOID_V
+#define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V
 #endif
 
 /* dir.c */
@@ -1963,6 +1987,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations;
 extern const struct inode_operations reiserfs_symlink_inode_operations;
 extern const struct inode_operations reiserfs_special_inode_operations;
 extern const struct file_operations reiserfs_dir_operations;
+int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *);
 
 /* tail_conversion.c */
 int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@@ -1984,8 +2009,15 @@ int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb,
 void unfix_nodes(struct tree_balance *);
 
 /* prints.c */
-void reiserfs_panic(struct super_block *s, const char *fmt, ...)
+void __reiserfs_panic(struct super_block *s, const char *id,
+                     const char *function, const char *fmt, ...)
     __attribute__ ((noreturn));
+#define reiserfs_panic(s, id, fmt, args...) \
+       __reiserfs_panic(s, id, __func__, fmt, ##args)
+void __reiserfs_error(struct super_block *s, const char *id,
+                     const char *function, const char *fmt, ...);
+#define reiserfs_error(s, id, fmt, args...) \
+        __reiserfs_error(s, id, __func__, fmt, ##args)
 void reiserfs_info(struct super_block *s, const char *fmt, ...);
 void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
 void print_indirect_item(struct buffer_head *bh, int item_num);
@@ -2022,7 +2054,7 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
                          int zeros_number);
 void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
                          int pos_in_item, int cut_size);
-void leaf_paste_entries(struct buffer_head *bh, int item_num, int before,
+void leaf_paste_entries(struct buffer_info *bi, int item_num, int before,
                        int new_entry_count, struct reiserfs_de_head *new_dehs,
                        const char *records, int paste_size);
 /* ibalance.c */
@@ -2200,7 +2232,4 @@ int reiserfs_unpack(struct inode *inode, struct file *filp);
 #define reiserfs_write_lock( sb ) lock_kernel()
 #define reiserfs_write_unlock( sb ) unlock_kernel()
 
-/* xattr stuff */
-#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
-
 #endif                         /* _LINUX_REISER_FS_H */