Commit Graph

242 Commits

Author SHA1 Message Date
Chris Mason
14048ed0c4 Btrfs: Cache extent buffer mappings
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
db94535db7 Btrfs: Allow tree blocks larger than the page size
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
1a5bc167f6 Btrfs: Change the remaining radix trees used by extent-tree.c to extent_map trees
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
96b5179d0d Btrfs: Stop using radix trees for the block group cache
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
f510cfecfc Btrfs: Fix extent_buffer and extent_state leaks
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
ae5252bd51 Btrfs: Go back to kmaps instead of page_address in extent_buffers
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
6d36dcd48f Btrfs: Avoid memcpy where possible in extent_buffers
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
479965d66e Btrfs: Optimizations for the extent_buffer code
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
5f39d397df Btrfs: Create extent_buffer interface for large blocksizes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
50b78c24d5 btrfs_get_extent should treat inline extents as though they hold a whole block
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Christoph Hellwig
b3cfa35a49 Btrfs: factor page private preparations into a helper
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Yan
8e1cd76664 Btrfs: Fix double free and off by one in inode.c
The first change removes  potential double free, the second fix a off
by one error.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Yan
bab9fb035f Btrfs: truncate: don't update inode->i_blocks when extent is a hole
I think check whether extent is a hole before update 'inode->i_blocks'
is unconditional required. (original codes check it only when
del_item isn't equal to 0)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Yan
23223584e4 create btrfs_path slab with the correct size
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Yan
a61721d5b7 fix found_type decrement in btrfs_truncate_in_trans
found_type has already been decreased by codes above the change,  I
think decrease it by one again doesn't make sense.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
cf67582bb2 Btrfs: Fix duplicate ENOSPC checks in find_free_extent
find_free_extent would fail to wrap around to the start of the drive because
it was doing the enospc case checking twice in some cases, causing it
to return -ENOSPC early.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:03:56 -04:00
Chris Mason
d3c2fdcf7b Btrfs: Use balance_dirty_pages_nr on btree blocks
btrfs_btree_balance_dirty is changed to pass the number of pages dirtied
for more accurate dirty throttling.  This lets the VM make better decisions
about when to force some writeback.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:00:48 -04:00
Yan
7d7d6068be Btrfs: Fix cache_block_group to catch holes at the start of the group
Cache block group was overly complex and missed free blocks at the very start
of the group.  This patch simplifies things significantly.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-14 16:15:28 -04:00
Yan
6af858b24c Btrfs: Fix off by one error in dirty_and_release_pages
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-14 10:23:29 -04:00
Christoph Hellwig
d03581f434 split up btrfs_ioctl
Add a helper per ioctl function to make the code more readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-14 10:22:57 -04:00
Christoph Hellwig
34287aa360 Btrfs: use unlocked_ioctl
No reason to grab the BKL before calling into the btrfs ioctl code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-14 10:22:47 -04:00
Jan Engelhardt
432eba0882 Btrfs: Simplify makefile
Single-colons will do here.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-14 10:22:19 -04:00
Chris Mason
84a5d5eefd Btrfs: add modules_install target
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-14 09:43:53 -04:00
Chris Mason
93a6925ec1 Btrfs: Fix extra link count dec in rename
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-14 09:42:31 -04:00
Chris Mason
5ce14bbcdd Btrfs: Find and remove dead roots the first time a root is loaded.
Dead roots are trees left over after a crash, and they were either in the
process of being removed or were waiting to be removed when the box crashed.
Before, a search of the entire tree of root pointers was done on mount
looking for dead roots.  Now, the search is done the first time we load
a root.

This makes mount faster when there are a large number of snapshots, and it
enables the block accounting code to properly update the block counts on
the latest root as old versions of the root are reaped after a crash.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-11 11:15:39 -04:00
Christoph Hellwig
0e2752a72c Btrfs: [PATCH] extent_map: add writepage_end_io hook
XFS updates the ondisk inode size only after the data I/O has finished,
so it needs a hook when the writepage end_bio handler has finished.

Might not be worth applying as-is as the per-page callback is very
ineffcient.  What XFS really wants is a callback when writeout of a
whole extent has completed.  This delayed i_size updates scheme might
be worthwile for btrfs aswell, btw.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 20:02:33 -04:00
Christoph Hellwig
b06355f0fe Btrfs: [PATCH] extent_map: make the writepage_io hook optional
The writepage_io is not mandatory, e.g. my port of xfs to the extent_map
code does not have one for now.  So handle a NULL pointer gracefully
here.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 20:02:32 -04:00
Christoph Hellwig
d396c6f554 Btrfs: [PATCH] extent_map: provide generic bmap
generic_bmap is completely trivial, while the extent to bh mapping in
btrfs is rather complex.  So provide a extent_bmap instead that takes
a get_extent callback and can be used by filesystem using the extent_map
code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 20:02:30 -04:00
Christoph Hellwig
90f1c19a9f Btrfs: [PATCH] extent_map: fix locking for bio completion
The bio completion handlers can be run in any context, e.g. when using
the old ide driver they run in hardirq context with irqs disabled so
lockdep rightfully warns about using write_lock_irq useage in these
handlers.

This patch switches clear_extent_bit and set_extent_bit to
write_lock_irqsave to fix this problem.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 20:02:27 -04:00
Christoph Hellwig
9433063bcb [PATCH] btrfs: fix printk format warning
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 20:02:22 -04:00
Chris Mason
a8c450b211 Btrfs: Reorder tests in set_extent_bit to properly find holes
Yan Zheng noticed that set_extent_bit was exiting too early when there
was a hole in the map.  The fix is to reorder the tests to check for the
hole first.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 20:00:27 -04:00
Chris Mason
011410bd85 Btrfs: Add more synchronization before creating a snapshot
File data checksums are only done during writepage, so we have to make sure
all pages are written when the snapshot is taken.  This also adds some
locking so that new writes don't race in and add new dirty pages.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 19:58:36 -04:00
Chris Mason
86479a04ee Add support for defragging files via btrfsctl -d. Avoid OOM on extent tree
defrag.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-09-10 19:58:16 -04:00
Chris Mason
8e21528f87 Btrfs: remove extra drop_extent_cache call
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-30 12:16:51 -04:00
Chris Mason
2bf5a725a3 Btrfs: fsx delalloc fixes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-30 11:54:02 -04:00
Chris Mason
07157aacb1 Btrfs: Add file data csums back in via hooks in the extent map code
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-30 08:50:51 -04:00
Chris Mason
95e0528919 Btrfs: Use mount -o subvol to select the subvol directory instead of dev:
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-29 09:11:44 -04:00
Yan
e9fe395e47 Btrfs: Fix oopsen in extent_tree.c during enospc
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-29 09:11:44 -04:00
Yan
4b82d6e4a5 Btrfs: Add mount into directory support
Modified form of original patch from Christoph Hellwig to make btrfs
mount into the default subvolume by default.

mount /dev/somedevice:subvolumename to get other subvolumes or
mount /dev/somedevice:. to get the root

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-29 09:11:44 -04:00
Yan
1b4ab1bb4b Btrfs: Fix mknod to properly send rdev info back to disk
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-29 09:11:44 -04:00
Yan
252c38f069 Btrfs: ctree.c cleanups
Fixup a few buffer_head release errors, and fix an off by one in
balance_node_right.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-29 09:11:44 -04:00
Josef Bacik
58176a9604 Btrfs: Add per-root block accounting and sysfs entries
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-29 15:47:34 -04:00
Chris Mason
b888db2bd7 Btrfs: Add delayed allocation to the extent based page tree code
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-27 16:49:44 -04:00
Chris Mason
a52d9a8033 Btrfs: Extent based page cache code. This uses an rbtree of extents and tests
instead of buffer heads.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-27 16:49:44 -04:00
Chris Mason
83df7c1d8b Btrfs: Make sure to cow the root during a snapshot
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-27 16:49:44 -04:00
Chris Mason
2cc58cf24f Btrfs: Do more extensive readahead during tree searches
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-27 16:49:44 -04:00
Yan
3202061128 fix block readahead in btrfs_next_leaf
Send the correct slot down to reada_for_search

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-27 15:17:54 -04:00
Josef Bacik
15ee9bc7ed Btrfs: delay commits during fsync to allow more writers
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-10 16:22:09 -04:00
Chris Mason
f2183bde1a Btrfs: Add BH_Defrag to mark buffers that are in need of defragging
This allows the tree walking code to defrag only the newly allocated
buffers, it seems to be a good balance between perfect defragging and the
performance hit of repeatedly reallocating blocks.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-10 14:42:37 -04:00
Chris Mason
e9d0b13b5b Btrfs: Btree defrag on the extent-mapping tree as well
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2007-08-10 14:06:19 -04:00