summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason2013-01-31 20:42:09 +0100
committerChris Mason2013-02-01 20:24:23 +0100
commit4ae10b3a133e1147f3c818fe2ebaf005b217b7bf (patch)
tree3934040efe3ae986811b54d96d4afba221575a00 /fs/btrfs/ctree.h
parentBtrfs: RAID5 and RAID6 (diff)
downloadkernel-qcow2-linux-4ae10b3a133e1147f3c818fe2ebaf005b217b7bf.tar.gz
kernel-qcow2-linux-4ae10b3a133e1147f3c818fe2ebaf005b217b7bf.tar.xz
kernel-qcow2-linux-4ae10b3a133e1147f3c818fe2ebaf005b217b7bf.zip
Btrfs: Add a stripe cache to raid56
The stripe cache allows us to avoid extra read/modify/write cycles by caching the pages we read off the disk. Pages are cached when: * They are read in during a read/modify/write cycle * They are written during a read/modify/write cycle * They are involved in a parity rebuild Pages are not cached if we're doing a full stripe write. We're assuming that a full stripe write won't be followed by another partial stripe write any time soon. This provides a substantial boost in performance for workloads that synchronously modify adjacent offsets in the file, and for the parity rebuild use case in general. The size of the stripe cache isn't tunable (yet) and is set at 1024 entries. Example on flash: dd if=/dev/zero of=/mnt/xxx bs=4K oflag=direct Without the stripe cache -- 2.1MB/s With the stripe cache 21MB/s Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 0cce3aafbd62..e3a4fd70f55a 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1244,7 +1244,10 @@ struct btrfs_stripe_hash {
/* used by the raid56 code to lock stripes for read/modify/write */
struct btrfs_stripe_hash_table {
- struct btrfs_stripe_hash *table;
+ struct list_head stripe_cache;
+ spinlock_t cache_lock;
+ int cache_size;
+ struct btrfs_stripe_hash table[];
};
#define BTRFS_STRIPE_HASH_TABLE_BITS 11