libata-sff: ap->[last_]ctl are SFF specific
[safe/jmp/linux-2.6] / include / linux / reiserfs_fs_sb.h
index ff9e923..52c83b6 100644 (file)
@@ -7,6 +7,8 @@
 #ifdef __KERNEL__
 #include <linux/workqueue.h>
 #include <linux/rwsem.h>
+#include <linux/mutex.h>
+#include <linux/sched.h>
 #endif
 
 typedef enum {
@@ -14,7 +16,7 @@ typedef enum {
 } reiserfs_super_block_flags;
 
 /* struct reiserfs_super_block accessors/mutators
- * since this is a disk structure, it will always be in 
+ * since this is a disk structure, it will always be in
  * little endian format. */
 #define sb_block_count(sbp)         (le32_to_cpu((sbp)->s_v1.s_block_count))
 #define set_sb_block_count(sbp,v)   ((sbp)->s_v1.s_block_count = cpu_to_le32(v))
@@ -73,6 +75,9 @@ typedef enum {
 #define sb_version(sbp)            (le16_to_cpu((sbp)->s_v1.s_version))
 #define set_sb_version(sbp,v)      ((sbp)->s_v1.s_version = cpu_to_le16(v))
 
+#define sb_mnt_count(sbp)         (le16_to_cpu((sbp)->s_mnt_count))
+#define set_sb_mnt_count(sbp, v)   ((sbp)->s_mnt_count = cpu_to_le16(v))
+
 #define sb_reserved_for_journal(sbp) \
               (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal))
 #define set_sb_reserved_for_journal(sbp,v) \
@@ -80,16 +85,16 @@ typedef enum {
 
 /* LOGGING -- */
 
-/* These all interelate for performance.  
+/* These all interelate for performance.
 **
-** If the journal block count is smaller than n transactions, you lose speed. 
+** If the journal block count is smaller than n transactions, you lose speed.
 ** I don't know what n is yet, I'm guessing 8-16.
 **
 ** typical transaction size depends on the application, how often fsync is
-** called, and how many metadata blocks you dirty in a 30 second period.  
+** called, and how many metadata blocks you dirty in a 30 second period.
 ** The more small files (<16k) you use, the larger your transactions will
 ** be.
-** 
+**
 ** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal
 ** to wrap, which slows things down.  If you need high speed meta data updates, the journal should be big enough
 ** to prevent wrapping before dirty meta blocks get to disk.
@@ -152,8 +157,8 @@ struct reiserfs_journal_list {
        atomic_t j_nonzerolen;
        atomic_t j_commit_left;
        atomic_t j_older_commits_done;  /* all commits older than this on disk */
-       struct semaphore j_commit_lock;
-       unsigned long j_trans_id;
+       struct mutex j_commit_mutex;
+       unsigned int j_trans_id;
        time_t j_timestamp;
        struct reiserfs_list_bitmap *j_list_bitmap;
        struct buffer_head *j_commit_bh;        /* commit buffer head */
@@ -177,25 +182,25 @@ struct reiserfs_journal {
        struct reiserfs_journal_cnode *j_last;  /* newest journal block */
        struct reiserfs_journal_cnode *j_first; /*  oldest journal block.  start here for traverse */
 
-       struct file *j_dev_file;
        struct block_device *j_dev_bd;
+       fmode_t j_dev_mode;
        int j_1st_reserved_block;       /* first block on s_dev of reserved area journal */
 
        unsigned long j_state;
-       unsigned long j_trans_id;
+       unsigned int j_trans_id;
        unsigned long j_mount_id;
        unsigned long j_start;  /* start of current waiting commit (index into j_ap_blocks) */
-       unsigned long j_len;    /* lenght of current waiting commit */
+       unsigned long j_len;    /* length of current waiting commit */
        unsigned long j_len_alloc;      /* number of buffers requested by journal_begin() */
        atomic_t j_wcount;      /* count of writers for current commit */
        unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */
        unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */
-       unsigned long j_last_flush_trans_id;    /* last fully flushed journal timestamp */
+       unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */
        struct buffer_head *j_header_bh;
 
        time_t j_trans_start_time;      /* time this transaction started */
-       struct semaphore j_lock;
-       struct semaphore j_flush_sem;
+       struct mutex j_mutex;
+       struct mutex j_flush_mutex;
        wait_queue_head_t j_join_wait;  /* wait for current transaction to finish before starting new one */
        atomic_t j_jlock;       /* lock for j_join_wait */
        int j_list_bitmap_index;        /* number of next list bitmap to use */
@@ -223,10 +228,10 @@ struct reiserfs_journal {
        int j_num_work_lists;   /* number that need attention from kreiserfsd */
 
        /* debugging to make sure things are flushed in order */
-       int j_last_flush_id;
+       unsigned int j_last_flush_id;
 
        /* debugging to make sure things are committed in order */
-       int j_last_commit_id;
+       unsigned int j_last_commit_id;
 
        struct list_head j_bitmap_nodes;
        struct list_head j_dirty_buffers;
@@ -239,7 +244,7 @@ struct reiserfs_journal {
 
        struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */
        struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */
-       struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE];    /* hash table for all the real buffer heads in all 
+       struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE];    /* hash table for all the real buffer heads in all
                                                                                   the transactions */
        struct list_head j_prealloc_list;       /* list of inodes which have preallocated blocks */
        int j_persistent_trans;
@@ -265,9 +270,7 @@ enum journal_state_bits {
 typedef __u32(*hashf_t) (const signed char *, int);
 
 struct reiserfs_bitmap_info {
-       // FIXME: Won't work with block sizes > 8K
-       __u16 first_zero_hint;
-       __u16 free_count;
+       __u32 free_count;
 };
 
 struct proc_dir_entry;
@@ -354,6 +357,13 @@ struct reiserfs_sb_info {
        struct reiserfs_journal *s_journal;     /* pointer to journal information */
        unsigned short s_mount_state;   /* reiserfs state (valid, invalid) */
 
+       /* Serialize writers access, replace the old bkl */
+       struct mutex lock;
+       /* Owner of the lock (can be recursive) */
+       struct task_struct *lock_owner;
+       /* Depth of the lock, start from -1 like the bkl */
+       int lock_depth;
+
        /* Comment? -Hans */
        void (*end_io_handler) (struct buffer_head *, int);
        hashf_t s_hash_function;        /* pointer to function which is used
@@ -401,15 +411,23 @@ struct reiserfs_sb_info {
        int reserved_blocks;    /* amount of blocks reserved for further allocations */
        spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
        struct dentry *priv_root;       /* root of /.reiserfs_priv */
-#ifdef CONFIG_REISERFS_FS_XATTR
-       struct dentry *xattr_root;      /* root of /.reiserfs_priv/.xa */
-       struct rw_semaphore xattr_dir_sem;
-#endif
+       struct dentry *xattr_root;      /* root of /.reiserfs_priv/xattrs */
        int j_errno;
 #ifdef CONFIG_QUOTA
        char *s_qf_names[MAXQUOTAS];
        int s_jquota_fmt;
 #endif
+#ifdef CONFIG_REISERFS_CHECK
+
+       struct tree_balance *cur_tb;    /*
+                                        * Detects whether more than one
+                                        * copy of tb exists per superblock
+                                        * as a means of checking whether
+                                        * do_balance is executing concurrently
+                                        * against another tree reader/writer
+                                        * on a same mount point.
+                                        */
+#endif
 };
 
 /* Definitions of reiserfs on-disk properties: */
@@ -428,7 +446,7 @@ enum reiserfs_mount_options {
                                   partition will be dealt with in a
                                   manner of 3.5.x */
 
-/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 
+/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
 ** reiserfs disks from 3.5.19 or earlier.  99% of the time, this option
 ** is not required.  If the normal autodection code can't determine which
 ** hash to use (because both hashes had the same value for a file)
@@ -453,9 +471,9 @@ enum reiserfs_mount_options {
        REISERFS_NO_UNHASHED_RELOCATION,
        REISERFS_HASHED_RELOCATION,
        REISERFS_ATTRS,
-       REISERFS_XATTRS,
        REISERFS_XATTRS_USER,
        REISERFS_POSIXACL,
+       REISERFS_EXPOSE_PRIVROOT,
        REISERFS_BARRIER_NONE,
        REISERFS_BARRIER_FLUSH,
 
@@ -491,9 +509,9 @@ enum reiserfs_mount_options {
 #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))
 #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))
 #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
-#define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS))
 #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
 #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL))
+#define reiserfs_expose_privroot(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT))
 #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
 #define reiserfs_barrier_none(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE))
 #define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH))