md: move offset, daemon_sleep and chunksize out of bitmap structure
[safe/jmp/linux-2.6] / drivers / md / md.h
index 9430a11..4b07e0a 100644 (file)
@@ -201,7 +201,7 @@ struct mddev_s
         * INTR:     resync needs to be aborted for some reason
         * DONE:     thread is done and is waiting to be reaped
         * REQUEST:  user-space has requested a sync (used with SYNC)
-        * CHECK:    user-space request for for check-only, no repair
+        * CHECK:    user-space request for check-only, no repair
         * RESHAPE:  A reshape is happening
         *
         * If neither SYNC or RESHAPE are set, then it is a recovery.
@@ -223,6 +223,16 @@ struct mddev_s
                                                            * so we don't loop trying */
 
        int                             in_sync;        /* know to not need resync */
+       /* 'open_mutex' avoids races between 'md_open' and 'do_md_stop', so
+        * that we are never stopping an array while it is open.
+        * 'reconfig_mutex' protects all other reconfiguration.
+        * These locks are separate due to conflicting interactions
+        * with bdev->bd_mutex.
+        * Lock ordering is:
+        *  reconfig_mutex -> bd_mutex : e.g. do_md_run -> revalidate_disk
+        *  bd_mutex -> open_mutex:  e.g. __blkdev_get -> md_open
+        */
+       struct mutex                    open_mutex;
        struct mutex                    reconfig_mutex;
        atomic_t                        active;         /* general refcount */
        atomic_t                        openers;        /* number of active opens */
@@ -270,17 +280,34 @@ struct mddev_s
        unsigned int                    max_write_behind; /* 0 = sync */
 
        struct bitmap                   *bitmap; /* the bitmap for the device */
-       struct file                     *bitmap_file; /* the bitmap file */
-       long                            bitmap_offset; /* offset from superblock of
-                                                       * start of bitmap. May be
-                                                       * negative, but not '0'
-                                                       */
-       long                            default_bitmap_offset; /* this is the offset to use when
-                                                               * hot-adding a bitmap.  It should
-                                                               * eventually be settable by sysfs.
-                                                               */
+       struct {
+               struct file             *file; /* the bitmap file */
+               long                    offset; /* offset from superblock of
+                                                * start of bitmap. May be
+                                                * negative, but not '0'
+                                                */
+               long                    default_offset; /* this is the offset to use when
+                                                        * hot-adding a bitmap.  It should
+                                                        * eventually be settable by sysfs.
+                                                        */
+               struct mutex            mutex;
+               unsigned long           chunksize;
+               unsigned long           daemon_sleep; /* how many seconds between updates? */
+               unsigned long           max_write_behind; /* write-behind mode */
+       } bitmap_info;
 
        struct list_head                all_mddevs;
+
+       /* Generic barrier handling.
+        * If there is a pending barrier request, all other
+        * writes are blocked while the devices are flushed.
+        * The last to finish a flush schedules a worker to
+        * submit the barrier request (without the barrier flag),
+        * then submit more flush requests.
+        */
+       struct bio *barrier;
+       atomic_t flush_pending;
+       struct work_struct barrier_work;
 };
 
 
@@ -420,6 +447,8 @@ extern void md_write_end(mddev_t *mddev);
 extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
 extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
 
+extern int mddev_congested(mddev_t *mddev, int bits);
+extern void md_barrier_request(mddev_t *mddev, struct bio *bio);
 extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
                           sector_t sector, int size, struct page *page);
 extern void md_super_wait(mddev_t *mddev);
@@ -431,5 +460,7 @@ extern int md_allow_write(mddev_t *mddev);
 extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
 extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors);
 extern int md_check_no_bitmap(mddev_t *mddev);
+extern int md_integrity_register(mddev_t *mddev);
+void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
 
 #endif /* _MD_MD_H */