GitHub/moto-9609/android_kernel_motorola_exynos9610.git
16 years agoBtrfs: Properly update free space cache in __free_extent
Yan [Tue, 6 Nov 2007 15:25:25 +0000 (10:25 -0500)]
Btrfs: Properly update free space cache in __free_extent

When pin_down_bytes decides not to pin a block because it was from the
current transaction, make sure the in memory cache of free extents is updated

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add writepages support
Chris Mason [Thu, 1 Nov 2007 23:45:34 +0000 (19:45 -0400)]
Btrfs: Add writepages support

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: small fixes for find_lock_delalloc_range.
Yan [Thu, 1 Nov 2007 15:28:42 +0000 (11:28 -0400)]
Btrfs: small fixes for find_lock_delalloc_range.

There is a 'finish_wait', but no 'prepare_to_wait' . So I think that
the 'prepare_to_wait' is missing. The second change is  according to
the name of variable.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix typo and memory leak in extent-tree.c
Yan [Thu, 1 Nov 2007 15:28:41 +0000 (11:28 -0400)]
Btrfs: Fix typo and memory leak in extent-tree.c

This patch fixes a typo in update_block_group and memory leak in
btrfs_free_block_groups.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix a number of inline extent problems that Yan Zheng reported.
Chris Mason [Thu, 1 Nov 2007 15:28:41 +0000 (11:28 -0400)]
Btrfs: Fix a number of inline extent problems that Yan Zheng reported.

The fixes do a number of things:

1) Most btrfs_drop_extent callers will try to leave the inline extents in
place.  It can truncate bytes off the beginning of the inline extent if
required.

2) writepage can now update the inline extent, allowing mmap writes to
go directly into the inline extent.

3) btrfs_truncate_in_transaction truncates inline extents

4) extent_map.c fixed to not merge inline extent mappings and hole
mappings together

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix PAGE_CACHE_SHIFT shifts on 32 bit machines
Chris Mason [Tue, 30 Oct 2007 20:56:53 +0000 (16:56 -0400)]
Btrfs: Fix PAGE_CACHE_SHIFT shifts on 32 bit machines

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoAdd O_SYNC support to btrfs_file_write
Chris Mason [Mon, 29 Oct 2007 18:36:41 +0000 (14:36 -0400)]
Add O_SYNC support to btrfs_file_write

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoMinor fix for btrfs_csum_file_block.
Yan [Mon, 29 Oct 2007 16:01:05 +0000 (12:01 -0400)]
Minor fix for btrfs_csum_file_block.

Execution should goto label 'insert' when 'btrfs_next_leaf' return a
non-zero value, otherwise the parameter 'slot' for
'btrfs_item_key_to_cpu' may be out of bounds. The original codes jump
to  label 'insert' only when 'btrfs_next_leaf' return a negative
value.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFix inline extent handling in btrfs_get_extent
Yan [Mon, 29 Oct 2007 15:41:07 +0000 (11:41 -0400)]
Fix inline extent handling in btrfs_get_extent

1.  Reorder kmap and the test for  'page != NULL'
2.  Zero-fill rest area of a block when inline extent isn't big enough.
3.  Do not insert extent_map into the map tree when page == NULL.
(If insert the extent_map into the map tree,  subsequent read requests
will find it in the map tree directly and the corresponding inline
extent data aren't copied into page by the the get_extent function.
extent_read_full_page can't handle that case)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix extent_map leak in extent_bmap
Yan [Mon, 29 Oct 2007 15:41:05 +0000 (11:41 -0400)]
Btrfs: Fix extent_map leak in extent_bmap

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Compile fixes for 2.6.24-rc1
Chris Mason [Mon, 29 Oct 2007 14:55:05 +0000 (10:55 -0400)]
Btrfs: Compile fixes for 2.6.24-rc1

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFix ENOTEMPTY check in btrfs_rmdir
Yan [Thu, 25 Oct 2007 19:49:25 +0000 (15:49 -0400)]
Fix ENOTEMPTY check in btrfs_rmdir

The ENOTEMPTY check in btrfs_rmdir isn't reliable. It's possible that
the backward search finds . or .. at first, then some other directory
entry. In that case,  btrfs_rmdir delete . or .. improperly.  The
patch also fixes a fs_mutex unlock issue in  btrfs_rmdir.

--

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs_inode_by_name return random value.
Yan [Thu, 25 Oct 2007 19:48:28 +0000 (15:48 -0400)]
btrfs_inode_by_name return random value.

When inode is found, the return value is from the uninitialized
variable 'ret'.

--

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Tune the automatic defrag code
Chris Mason [Thu, 25 Oct 2007 19:43:18 +0000 (15:43 -0400)]
Btrfs: Tune the automatic defrag code

1) Forced defrag wasn't working properly (btrfsctl -d) because some
cache only checks were incorrect.

2) Defrag only the leaves unless in forced defrag mode.

3) Don't use complex logic to figure out if a leaf is needs defrag

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix for insert_inline_extent to handle offset != 0
Yan [Thu, 25 Oct 2007 19:42:57 +0000 (15:42 -0400)]
Btrfs: Fix for insert_inline_extent to handle offset != 0

This modifies inline extent size calculation, so that
insert_inline_extent can handle the case that parameter 'offset' is
not zero; it also a few codes to zero uninitialized area in inline
extent.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix split_leaf to detect when it is extending an item
Chris Mason [Thu, 25 Oct 2007 19:42:57 +0000 (15:42 -0400)]
Btrfs: Fix split_leaf to detect when it is extending an item

When making room for a new item, it is ok to create an empty leaf, but
when making room to extend an item, split_leaf needs to make sure it
keeps the item we're extending in the path and make sure we don't end up
with an empty leaf.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Off by one fixes in extent_map.c
Yan [Thu, 25 Oct 2007 19:42:57 +0000 (15:42 -0400)]
Btrfs: Off by one fixes in extent_map.c

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Optimize csum insertion to create larger items when possible
Chris Mason [Thu, 25 Oct 2007 19:42:56 +0000 (15:42 -0400)]
Btrfs: Optimize csum insertion to create larger items when possible

This reduces the number of calls to btrfs_extend_item and greatly lowers
the cpu usage while writing large files.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix split_leaf to avoid incorrect double splits
Chris Mason [Fri, 19 Oct 2007 18:01:21 +0000 (14:01 -0400)]
Btrfs: Fix split_leaf to avoid incorrect double splits

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Avoid recursive KM_USER1 mappings in copy_extent_buffer
Chris Mason [Fri, 19 Oct 2007 14:39:41 +0000 (10:39 -0400)]
Btrfs: Avoid recursive KM_USER1 mappings in copy_extent_buffer

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: CPU usage optimizations in push and the extent_map code
Chris Mason [Fri, 19 Oct 2007 13:23:27 +0000 (09:23 -0400)]
Btrfs: CPU usage optimizations in push and the extent_map code

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix read/write_extent_buffer to use KM_USER1 instead of KM_USER0
Chris Mason [Fri, 19 Oct 2007 13:23:09 +0000 (09:23 -0400)]
Btrfs: Fix read/write_extent_buffer to use KM_USER1 instead of KM_USER0

This avoids recursive use of KM_USER0 during btrfs_file_write

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: sysfs compile fixup
Jens Axboe [Fri, 19 Oct 2007 13:23:08 +0000 (09:23 -0400)]
Btrfs: sysfs compile fixup

Just use kobject_set_name(), that works in all kernels (I think...).
Kernels newer than 2.6.23 currently fail with:

/home/axboe/git/btrfs/btrfs-unstable/sysfs.c:188: error: unknown field
'name' specified in initializer

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: KM_IRQ0 usage in end_io handling
Jens Axboe [Fri, 19 Oct 2007 13:23:07 +0000 (09:23 -0400)]
Btrfs: KM_IRQ0 usage in end_io handling

endio handling is typically called with interrupts disabled, but can
also be called with it enabled. So save interrupts before using KM_IRQ0
to be completely safe.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix bi_end_io() functions on > 2.6.23 kernels
Jens Axboe [Fri, 19 Oct 2007 13:23:05 +0000 (09:23 -0400)]
Btrfs: Fix bi_end_io() functions on > 2.6.23 kernels

It now returns void and it is never called for partial completions, so
the bio->bi_size check must go.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs: 32-bit type problems
Jens Axboe [Fri, 19 Oct 2007 13:22:59 +0000 (09:22 -0400)]
btrfs: 32-bit type problems

An assorted set of casts to get rid of the warnings on 32-bit archs.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Properly setup root key while reading the root
Yan Zheng [Fri, 19 Oct 2007 13:22:56 +0000 (09:22 -0400)]
Btrfs: Properly setup root key while reading the root

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix typo: owner is a 64 bit field
Chris Mason [Fri, 19 Oct 2007 13:22:49 +0000 (09:22 -0400)]
Btrfs: Fix typo: owner is a 64 bit field

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Default to 8k max packed tails
Chris Mason [Fri, 19 Oct 2007 13:22:41 +0000 (09:22 -0400)]
Btrfs: Default to 8k max packed tails

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Defrag only leaves, and only when the parent node has a single objectid
Chris Mason [Mon, 15 Oct 2007 20:22:39 +0000 (16:22 -0400)]
Btrfs: Defrag only leaves, and only when the parent node has a single objectid

This allows us to defrag huge directories, but skip the expensive defrag
case in more common usage, where it does not help as much.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add back file data checksumming
Chris Mason [Mon, 15 Oct 2007 20:22:25 +0000 (16:22 -0400)]
Btrfs: Add back file data checksumming

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Defrag: only walk into nodes with the defrag bit set
Chris Mason [Mon, 15 Oct 2007 20:22:11 +0000 (16:22 -0400)]
Btrfs: Defrag: only walk into nodes with the defrag bit set

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: balance_dirty_pages_ratelimited is causing problems, use nr == 1 always
Chris Mason [Mon, 15 Oct 2007 20:21:17 +0000 (16:21 -0400)]
Btrfs: balance_dirty_pages_ratelimited is causing problems, use nr == 1 always

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Large block related defrag optimizations
Chris Mason [Mon, 15 Oct 2007 20:19:46 +0000 (16:19 -0400)]
Btrfs: Large block related defrag optimizations

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add back metadata checksumming
Chris Mason [Mon, 15 Oct 2007 20:19:22 +0000 (16:19 -0400)]
Btrfs: Add back metadata checksumming

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBreakout BTRFS_SETGET_FUNCS into a separate C file, the inlines were too big.
Chris Mason [Mon, 15 Oct 2007 20:18:56 +0000 (16:18 -0400)]
Breakout BTRFS_SETGET_FUNCS into a separate C file, the inlines were too big.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: extent_map optimizations to cut down on CPU usage
Chris Mason [Mon, 15 Oct 2007 20:18:55 +0000 (16:18 -0400)]
Btrfs: extent_map optimizations to cut down on CPU usage

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Allow tails larger than one page
Chris Mason [Mon, 15 Oct 2007 20:18:25 +0000 (16:18 -0400)]
Btrfs: Allow tails larger than one page

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add an extent buffer LRU to reduce radix tree hits
Chris Mason [Mon, 15 Oct 2007 20:18:14 +0000 (16:18 -0400)]
Btrfs: Add an extent buffer LRU to reduce radix tree hits

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix allocation routines to avoid intermixing data and metadata allocations
Chris Mason [Mon, 15 Oct 2007 20:17:44 +0000 (16:17 -0400)]
Btrfs: Fix allocation routines to avoid intermixing data and metadata allocations

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add back the online defragging code
Chris Mason [Mon, 15 Oct 2007 20:17:34 +0000 (16:17 -0400)]
Btrfs: Add back the online defragging code

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Use an array of pages in the extent buffers to reduce the cost of find_get_page
Chris Mason [Mon, 15 Oct 2007 20:17:04 +0000 (16:17 -0400)]
Btrfs: Use an array of pages in the extent buffers to reduce the cost of find_get_page

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Cache extent buffer mappings
Chris Mason [Mon, 15 Oct 2007 20:16:28 +0000 (16:16 -0400)]
Btrfs: Cache extent buffer mappings

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Allow tree blocks larger than the page size
Chris Mason [Mon, 15 Oct 2007 20:15:53 +0000 (16:15 -0400)]
Btrfs: Allow tree blocks larger than the page size

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Change the remaining radix trees used by extent-tree.c to extent_map trees
Chris Mason [Mon, 15 Oct 2007 20:15:26 +0000 (16:15 -0400)]
Btrfs: Change the remaining radix trees used by extent-tree.c to extent_map trees

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Stop using radix trees for the block group cache
Chris Mason [Mon, 15 Oct 2007 20:15:19 +0000 (16:15 -0400)]
Btrfs: Stop using radix trees for the block group cache

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix extent_buffer and extent_state leaks
Chris Mason [Mon, 15 Oct 2007 20:14:48 +0000 (16:14 -0400)]
Btrfs: Fix extent_buffer and extent_state leaks

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Go back to kmaps instead of page_address in extent_buffers
Chris Mason [Mon, 15 Oct 2007 20:14:41 +0000 (16:14 -0400)]
Btrfs: Go back to kmaps instead of page_address in extent_buffers

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Avoid memcpy where possible in extent_buffers
Chris Mason [Mon, 15 Oct 2007 20:14:37 +0000 (16:14 -0400)]
Btrfs: Avoid memcpy where possible in extent_buffers

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Optimizations for the extent_buffer code
Chris Mason [Mon, 15 Oct 2007 20:14:27 +0000 (16:14 -0400)]
Btrfs: Optimizations for the extent_buffer code

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Create extent_buffer interface for large blocksizes
Chris Mason [Mon, 15 Oct 2007 20:14:19 +0000 (16:14 -0400)]
Btrfs: Create extent_buffer interface for large blocksizes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs_get_extent should treat inline extents as though they hold a whole block
Chris Mason [Thu, 20 Sep 2007 18:14:42 +0000 (14:14 -0400)]
btrfs_get_extent should treat inline extents as though they hold a whole block

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: factor page private preparations into a helper
Christoph Hellwig [Mon, 17 Sep 2007 15:25:58 +0000 (11:25 -0400)]
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>
16 years agoBtrfs: Fix double free and off by one in inode.c
Yan [Mon, 17 Sep 2007 15:13:12 +0000 (11:13 -0400)]
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>
16 years agoBtrfs: truncate: don't update inode->i_blocks when extent is a hole
Yan [Mon, 17 Sep 2007 15:13:11 +0000 (11:13 -0400)]
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>
16 years agocreate btrfs_path slab with the correct size
Yan [Mon, 17 Sep 2007 15:08:52 +0000 (11:08 -0400)]
create btrfs_path slab with the correct size

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agofix found_type decrement in btrfs_truncate_in_trans
Yan [Mon, 17 Sep 2007 15:08:38 +0000 (11:08 -0400)]
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>
16 years agoBtrfs: Fix duplicate ENOSPC checks in find_free_extent
Chris Mason [Mon, 17 Sep 2007 15:00:51 +0000 (11:00 -0400)]
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>
16 years agoBtrfs: Use balance_dirty_pages_nr on btree blocks
Chris Mason [Mon, 17 Sep 2007 14:58:06 +0000 (10:58 -0400)]
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>
17 years agoBtrfs: Fix cache_block_group to catch holes at the start of the group
Yan [Fri, 14 Sep 2007 20:15:28 +0000 (16:15 -0400)]
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>
17 years agoBtrfs: Fix off by one error in dirty_and_release_pages
Yan [Fri, 14 Sep 2007 14:23:29 +0000 (10:23 -0400)]
Btrfs: Fix off by one error in dirty_and_release_pages

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agosplit up btrfs_ioctl
Christoph Hellwig [Fri, 14 Sep 2007 14:22:57 +0000 (10:22 -0400)]
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>
17 years agoBtrfs: use unlocked_ioctl
Christoph Hellwig [Fri, 14 Sep 2007 14:22:47 +0000 (10:22 -0400)]
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>
17 years agoBtrfs: Simplify makefile
Jan Engelhardt [Fri, 14 Sep 2007 14:22:19 +0000 (10:22 -0400)]
Btrfs: Simplify makefile

Single-colons will do here.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: add modules_install target
Chris Mason [Fri, 14 Sep 2007 13:43:53 +0000 (09:43 -0400)]
Btrfs: add modules_install target

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Fix extra link count dec in rename
Chris Mason [Fri, 14 Sep 2007 13:42:31 +0000 (09:42 -0400)]
Btrfs: Fix extra link count dec in rename

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Added tag v0.8 for changeset f5ce4cc64def
Chris Mason [Tue, 11 Sep 2007 23:45:31 +0000 (19:45 -0400)]
Btrfs: Added tag v0.8 for changeset f5ce4cc64def

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Find and remove dead roots the first time a root is loaded.
Chris Mason [Tue, 11 Sep 2007 15:15:39 +0000 (11:15 -0400)]
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>
17 years agoBtrfs: [PATCH] extent_map: add writepage_end_io hook
Christoph Hellwig [Tue, 11 Sep 2007 00:02:33 +0000 (20:02 -0400)]
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>
17 years agoBtrfs: [PATCH] extent_map: make the writepage_io hook optional
Christoph Hellwig [Tue, 11 Sep 2007 00:02:32 +0000 (20:02 -0400)]
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>
17 years agoBtrfs: [PATCH] extent_map: provide generic bmap
Christoph Hellwig [Tue, 11 Sep 2007 00:02:30 +0000 (20:02 -0400)]
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>
17 years agoBtrfs: [PATCH] extent_map: fix locking for bio completion
Christoph Hellwig [Tue, 11 Sep 2007 00:02:27 +0000 (20:02 -0400)]
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>
17 years ago[PATCH] btrfs: fix printk format warning
Christoph Hellwig [Tue, 11 Sep 2007 00:02:22 +0000 (20:02 -0400)]
[PATCH] btrfs: fix printk format warning

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Reorder tests in set_extent_bit to properly find holes
Chris Mason [Tue, 11 Sep 2007 00:00:27 +0000 (20:00 -0400)]
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>
17 years agoBtrfs: Add more synchronization before creating a snapshot
Chris Mason [Mon, 10 Sep 2007 23:58:36 +0000 (19:58 -0400)]
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>
17 years agoAdd support for defragging files via btrfsctl -d. Avoid OOM on extent tree
Chris Mason [Mon, 10 Sep 2007 23:58:16 +0000 (19:58 -0400)]
Add support for defragging files via btrfsctl -d.  Avoid OOM on extent tree
defrag.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: remove extra drop_extent_cache call
Chris Mason [Thu, 30 Aug 2007 16:16:51 +0000 (12:16 -0400)]
Btrfs: remove extra drop_extent_cache call

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: fsx delalloc fixes
Chris Mason [Thu, 30 Aug 2007 15:54:02 +0000 (11:54 -0400)]
Btrfs: fsx delalloc fixes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Add file data csums back in via hooks in the extent map code
Chris Mason [Thu, 30 Aug 2007 12:50:51 +0000 (08:50 -0400)]
Btrfs: Add file data csums back in via hooks in the extent map code

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Use mount -o subvol to select the subvol directory instead of dev:
Chris Mason [Wed, 29 Aug 2007 13:11:44 +0000 (09:11 -0400)]
Btrfs: Use mount -o subvol to select the subvol directory instead of dev:

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Fix oopsen in extent_tree.c during enospc
Yan [Wed, 29 Aug 2007 13:11:44 +0000 (09:11 -0400)]
Btrfs: Fix oopsen in extent_tree.c during enospc

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Add mount into directory support
Yan [Wed, 29 Aug 2007 13:11:44 +0000 (09:11 -0400)]
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>
17 years agoBtrfs: Fix mknod to properly send rdev info back to disk
Yan [Wed, 29 Aug 2007 13:11:44 +0000 (09:11 -0400)]
Btrfs: Fix mknod to properly send rdev info back to disk

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: ctree.c cleanups
Yan [Wed, 29 Aug 2007 13:11:44 +0000 (09:11 -0400)]
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>
17 years agoBtrfs: Add per-root block accounting and sysfs entries
Josef Bacik [Wed, 29 Aug 2007 19:47:34 +0000 (15:47 -0400)]
Btrfs: Add per-root block accounting and sysfs entries

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Add delayed allocation to the extent based page tree code
Chris Mason [Mon, 27 Aug 2007 20:49:44 +0000 (16:49 -0400)]
Btrfs: Add delayed allocation to the extent based page tree code

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Extent based page cache code. This uses an rbtree of extents and tests
Chris Mason [Mon, 27 Aug 2007 20:49:44 +0000 (16:49 -0400)]
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>
17 years agoBtrfs: Make sure to cow the root during a snapshot
Chris Mason [Mon, 27 Aug 2007 20:49:44 +0000 (16:49 -0400)]
Btrfs: Make sure to cow the root during a snapshot

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Do more extensive readahead during tree searches
Chris Mason [Mon, 27 Aug 2007 20:49:44 +0000 (16:49 -0400)]
Btrfs: Do more extensive readahead during tree searches

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agofix block readahead in btrfs_next_leaf
Yan [Mon, 27 Aug 2007 19:17:54 +0000 (15:17 -0400)]
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>
17 years agoBtrfs: Added tag v0.7 for changeset 6125224d77d0
Chris Mason [Fri, 10 Aug 2007 20:32:29 +0000 (16:32 -0400)]
Btrfs: Added tag v0.7 for changeset 6125224d77d0

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: delay commits during fsync to allow more writers
Josef Bacik [Fri, 10 Aug 2007 20:22:09 +0000 (16:22 -0400)]
Btrfs: delay commits during fsync to allow more writers

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Add BH_Defrag to mark buffers that are in need of defragging
Chris Mason [Fri, 10 Aug 2007 18:42:37 +0000 (14:42 -0400)]
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>
17 years agoBtrfs: Btree defrag on the extent-mapping tree as well
Chris Mason [Fri, 10 Aug 2007 18:06:19 +0000 (14:06 -0400)]
Btrfs: Btree defrag on the extent-mapping tree as well

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Further reduce the concurrency penalty of defrag and drop_snapshot
Chris Mason [Thu, 9 Aug 2007 00:17:12 +0000 (20:17 -0400)]
Btrfs: Further reduce the concurrency penalty of defrag and drop_snapshot

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Replace extent tree preallocation code with some bit radix magic.
Chris Mason [Thu, 9 Aug 2007 00:17:12 +0000 (20:17 -0400)]
Btrfs: Replace extent tree preallocation code with some bit radix magic.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Let some locks go during defrag and snapshot dropping
Chris Mason [Wed, 8 Aug 2007 14:08:58 +0000 (10:08 -0400)]
Btrfs: Let some locks go during defrag and snapshot dropping

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Added tag v0.6 for changeset c13e9a0bf9b4
Chris Mason [Tue, 7 Aug 2007 20:35:25 +0000 (16:35 -0400)]
Btrfs: Added tag v0.6 for changeset c13e9a0bf9b4

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Add run time btree defrag, and an ioctl to force btree defrag
Chris Mason [Tue, 7 Aug 2007 20:15:09 +0000 (16:15 -0400)]
Btrfs: Add run time btree defrag, and an ioctl to force btree defrag

This adds two types of btree defrag, a run time form that tries to
defrag recently allocated blocks in the btree when they are still in ram,
and an ioctl that forces defrag of all btree blocks.

File data blocks are not defragged yet, but this can make a huge difference
in sequential btree reads.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
17 years agoBtrfs: Fold some btree readahead routines into something more generic.
Chris Mason [Tue, 7 Aug 2007 19:52:22 +0000 (15:52 -0400)]
Btrfs: Fold some btree readahead routines into something more generic.

Signed-off-by: Chris Mason <chris.mason@oracle.com>