On Wed, Jun 13, 2012 at 06:19:08PM +0800, Liu Bo wrote:
> We used to issue a checksum to an extent state of 4K range for read endio,
> but now we want to use larger range for performance optimization, so instead we
> create a radix tree for checksum, where an item stands for checksum of 4K data.
>
> Signed-off-by: Liu Bo <liubo2009@xxxxxxxxxxxxxx>
> ---
> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> index 25900af..c896962 100644
> --- a/fs/btrfs/extent_io.h
> +++ b/fs/btrfs/extent_io.h
> @@ -96,11 +96,13 @@ struct extent_io_ops {
> struct extent_io_tree {
> struct rb_root state;
> struct radix_tree_root buffer;
> + struct radix_tree_root csum;
> struct address_space *mapping;
> u64 dirty_bytes;
> int track_uptodate;
> spinlock_t lock;
> spinlock_t buffer_lock;
> + spinlock_t csum_lock;
I'm afraid 3 spinlocks sharing the same cacheline will bite and hurt
performance.
struct extent_io_tree {
struct rb_root state; /* 0 8 */
struct radix_tree_root buffer; /* 8 16 */
struct radix_tree_root csum; /* 24 16 */
struct address_space * mapping; /* 40 8 */
u64 dirty_bytes; /* 48 8 */
int track_uptodate; /* 56 4 */
/* XXX 4 bytes hole, try to pack */
/* --- cacheline 1 boundary (64 bytes) --- */
rwlock_t lock; /* 64 8 */
spinlock_t buffer_lock; /* 72 4 */
spinlock_t csum_lock; /* 76 4 */
struct extent_io_ops * ops; /* 80 8 */
/* size: 88, cachelines: 2, members: 10 */
/* sum members: 84, holes: 1, sum holes: 4 */
/* last cacheline: 24 bytes */
};
so we have to live with 2 cachenlines, maybe it'll be enough to split
the structure to 2 sections depending on the access paterns. Definetely
for later, but I think it should be noted as the patchset tries to
improve performance.
> struct extent_io_ops *ops;
> };
david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html