]> Pileus Git - ~andy/linux/blobdiff - fs/btrfs/volumes.h
btrfs: quasi-round-robin for chunk allocation
[~andy/linux] / fs / btrfs / volumes.h
index 2740db49eb04d7a8de03d18e5935a97ff43ef9db..37ae6e2126a1cde2624228f20aab137071584a8a 100644 (file)
 #define __BTRFS_VOLUMES_
 
 #include <linux/bio.h>
+#include <linux/sort.h>
 #include "async-thread.h"
 
+#define BTRFS_STRIPE_LEN       (64 * 1024)
+
 struct buffer_head;
 struct btrfs_pending_bios {
        struct bio *head;
@@ -50,7 +53,7 @@ struct btrfs_device {
 
        struct block_device *bdev;
 
-       /* the mode sent to open_bdev_exclusive */
+       /* the mode sent to blkdev_get */
        fmode_t mode;
 
        char *name;
@@ -123,6 +126,7 @@ struct btrfs_fs_devices {
 struct btrfs_bio_stripe {
        struct btrfs_device *dev;
        u64 physical;
+       u64 length; /* only used for discard mappings */
 };
 
 struct btrfs_multi_bio {
@@ -136,6 +140,27 @@ struct btrfs_multi_bio {
        struct btrfs_bio_stripe stripes[];
 };
 
+struct btrfs_device_info {
+       struct btrfs_device *dev;
+       u64 dev_offset;
+       u64 max_avail;
+       u64 total_avail;
+};
+
+struct map_lookup {
+       u64 type;
+       int io_align;
+       int io_width;
+       int stripe_len;
+       int sector_size;
+       int num_stripes;
+       int sub_stripes;
+       struct btrfs_bio_stripe stripes[];
+};
+
+int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start,
+                                  u64 end, u64 *length);
+
 #define btrfs_multi_bio_size(n) (sizeof(struct btrfs_multi_bio) + \
                            (sizeof(struct btrfs_bio_stripe) * (n)))