Skip to content

Commit

Permalink
Btrfs: Split the extent_map code into two parts
Browse files Browse the repository at this point in the history
There is now extent_map for mapping offsets in the file to disk and
extent_io for state tracking, IO submission and extent_bufers.

The new extent_map code shifts from [start,end] pairs to [start,len], and
pushes the locking out into the caller.  This allows a few performance
optimizations and is easier to use.

A number of extent_map usage bugs were fixed, mostly with failing
to remove extent_map entries when changing the file.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 5f56406 commit d1310b2
Show file tree
Hide file tree
Showing 14 changed files with 3,612 additions and 3,413 deletions.
3 changes: 2 additions & 1 deletion fs/btrfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ obj-m := btrfs.o
btrfs-y := super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
hash.o file-item.o inode-item.o inode-map.o disk-io.o \
transaction.o bit-radix.o inode.o file.o tree-defrag.o \
extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o
extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o \
extent_io.o

ifeq ($(CONFIG_FS_POSIX_ACL),y)
btrfs-y += acl.o
Expand Down
2 changes: 2 additions & 0 deletions fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
#define __BTRFS_I__

#include "extent_map.h"
#include "extent_io.h"

/* in memory btrfs inode */
struct btrfs_inode {
struct btrfs_root *root;
struct btrfs_block_group_cache *block_group;
struct btrfs_key location;
struct extent_map_tree extent_tree;
struct extent_io_tree io_tree;
struct inode vfs_inode;

u64 ordered_trans;
Expand Down
15 changes: 8 additions & 7 deletions fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/completion.h>
#include <asm/kmap_types.h>
#include "bit-radix.h"
#include "extent_io.h"
#include "extent_map.h"

struct btrfs_trans_handle;
Expand Down Expand Up @@ -314,11 +315,11 @@ struct btrfs_fs_info {
struct btrfs_root *tree_root;
struct radix_tree_root fs_roots_radix;

struct extent_map_tree free_space_cache;
struct extent_map_tree block_group_cache;
struct extent_map_tree pinned_extents;
struct extent_map_tree pending_del;
struct extent_map_tree extent_ins;
struct extent_io_tree free_space_cache;
struct extent_io_tree block_group_cache;
struct extent_io_tree pinned_extents;
struct extent_io_tree pending_del;
struct extent_io_tree extent_ins;

u64 generation;
u64 last_trans_committed;
Expand Down Expand Up @@ -956,7 +957,7 @@ u32 btrfs_count_snapshots_in_path(struct btrfs_root *root,
u64 first_extent);
int btrfs_extent_post_op(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
int btrfs_copy_pinned(struct btrfs_root *root, struct extent_map_tree *copy);
int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy);
struct btrfs_block_group_cache *btrfs_lookup_block_group(struct
btrfs_fs_info *info,
u64 bytenr);
Expand Down Expand Up @@ -1001,7 +1002,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
u64 owner_objectid, u64 owner_offset, int pin);
int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_map_tree *unpin);
struct extent_io_tree *unpin);
int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 bytenr, u64 num_bytes,
Expand Down
Loading

0 comments on commit d1310b2

Please sign in to comment.