xfs: reclaim inodes under a write lock
[safe/jmp/linux-2.6] / fs / btrfs / volumes.h
index 86c44e9..31b0fab 100644 (file)
 #include "async-thread.h"
 
 struct buffer_head;
+struct btrfs_pending_bios {
+       struct bio *head;
+       struct bio *tail;
+};
+
 struct btrfs_device {
        struct list_head dev_list;
        struct list_head dev_alloc_list;
        struct btrfs_fs_devices *fs_devices;
        struct btrfs_root *dev_root;
-       struct bio *pending_bios;
-       struct bio *pending_bio_tail;
+
+       /* regular prio bios */
+       struct btrfs_pending_bios pending_bios;
+       /* WRITE_SYNC bios */
+       struct btrfs_pending_bios pending_sync_bios;
+
        int running_pending;
        u64 generation;
 
@@ -52,6 +61,9 @@ struct btrfs_device {
        /* size of the device */
        u64 total_bytes;
 
+       /* size of the disk */
+       u64 disk_total_bytes;
+
        /* bytes used */
        u64 bytes_used;
 
@@ -76,7 +88,7 @@ struct btrfs_device {
 struct btrfs_fs_devices {
        u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
 
-       /* the device with this id has the most recent coyp of the super */
+       /* the device with this id has the most recent copy of the super */
        u64 latest_devid;
        u64 latest_trans;
        u64 num_devices;
@@ -84,7 +96,12 @@ struct btrfs_fs_devices {
        u64 rw_devices;
        u64 total_rw_bytes;
        struct block_device *latest_bdev;
-       /* all of the devices in the FS */
+
+       /* all of the devices in the FS, protected by a mutex
+        * so we can safely walk it to write out the supers without
+        * worrying about add/remove by the multi-device code
+        */
+       struct mutex device_list_mutex;
        struct list_head devices;
 
        /* devices not currently being allocated */
@@ -95,6 +112,11 @@ struct btrfs_fs_devices {
        int seeding;
 
        int opened;
+
+       /* set when we find or add a device that doesn't have the
+        * nonrot flag set
+        */
+       int rotating;
 };
 
 struct btrfs_bio_stripe {
@@ -159,4 +181,7 @@ int btrfs_balance(struct btrfs_root *dev_root);
 void btrfs_unlock_volumes(void);
 void btrfs_lock_volumes(void);
 int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset);
+int find_free_dev_extent(struct btrfs_trans_handle *trans,
+                        struct btrfs_device *device, u64 num_bytes,
+                        u64 *start, u64 *max_avail);
 #endif