openwrt/staging/blogic.git
16 years agoBtrfs: Add drop inode func to avoid data=ordered deadlock
Chris Mason [Mon, 14 Jan 2008 21:24:38 +0000 (16:24 -0500)]
Btrfs: Add drop inode func to avoid data=ordered deadlock

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Delete any remaining extent_maps before freeing the inode
Chris Mason [Mon, 14 Jan 2008 20:10:26 +0000 (15:10 -0500)]
Btrfs: Delete any remaining extent_maps before freeing the inode

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Only delete roots from sysfs when they were added to sysfs
Chris Mason [Mon, 14 Jan 2008 19:41:16 +0000 (14:41 -0500)]
Btrfs: Only delete roots from sysfs when they were added to sysfs

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Change magic string to reflect new format
Chris Mason [Mon, 14 Jan 2008 19:33:35 +0000 (14:33 -0500)]
Btrfs: Change magic string to reflect new format

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add readonly inode flag
Yan [Mon, 14 Jan 2008 18:26:08 +0000 (13:26 -0500)]
Btrfs: Add readonly inode flag

This patch adds readonly inode flag support.  A file with this flag
can't be modified, but can be deleted.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Implement ACLs setting and getting
Yan [Mon, 14 Jan 2008 18:26:08 +0000 (13:26 -0500)]
Btrfs: Implement ACLs setting and getting

ACLs are stored but not used for permission checks (yet)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Remove verbose WARN_ON
Chris Mason [Mon, 14 Jan 2008 18:22:53 +0000 (13:22 -0500)]
Btrfs: Remove verbose WARN_ON

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix extent_buffer usage when nodesize != leafsize
Chris Mason [Wed, 9 Jan 2008 20:55:33 +0000 (15:55 -0500)]
Btrfs: Fix extent_buffer usage when nodesize != leafsize

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add flush barriers on commit
Chris Mason [Wed, 9 Jan 2008 14:23:21 +0000 (09:23 -0500)]
Btrfs: Add flush barriers on commit

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Remove extent_map debugging message
Chris Mason [Wed, 9 Jan 2008 11:28:28 +0000 (06:28 -0500)]
Btrfs: Remove extent_map debugging message

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add inode flags support
Yan [Tue, 8 Jan 2008 20:54:37 +0000 (15:54 -0500)]
Btrfs: Add inode flags support

This patch adds NODATASUM & NODATACOW inode flags support.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: online shrinking fixes
Chris Mason [Tue, 8 Jan 2008 20:46:31 +0000 (15:46 -0500)]
Btrfs: online shrinking fixes

While shrinking the FS, the allocation functions need to make sure
they don't try to allocate bytes past the end of the FS.

nodatacow needed an extra check to force cows when the existing extents are
past the end of the FS.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Disable btree reada during extent backref lookups.
Chris Mason [Tue, 8 Jan 2008 20:46:31 +0000 (15:46 -0500)]
Btrfs: Disable btree reada during extent backref lookups.

This reada is generally not effective.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add some simple throttling to wait for data=ordered and snapshot deletion
Chris Mason [Tue, 8 Jan 2008 20:46:30 +0000 (15:46 -0500)]
Btrfs: Add some simple throttling to wait for data=ordered and snapshot deletion

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Move snapshot creation to commit time
Chris Mason [Tue, 8 Jan 2008 20:46:30 +0000 (15:46 -0500)]
Btrfs: Move snapshot creation to commit time

It is very difficult to create a consistent snapshot of the btree when
other writers may update the btree before the commit is done.

This changes the snapshot creation to happen during the commit, while
no other updates are possible.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add data=ordered support
Chris Mason [Tue, 8 Jan 2008 20:46:30 +0000 (15:46 -0500)]
Btrfs: Add data=ordered support

This forces file data extents down the disk along with the metadata that
references them.  The current implementation is fairly simple, and just
writes out all of the dirty pages in an inode before the commit.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Change tree block csum tagging to avoid false error messages
Chris Mason [Tue, 8 Jan 2008 20:46:27 +0000 (15:46 -0500)]
Btrfs: Change tree block csum tagging to avoid false error messages

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: resizer: don't hold the fs_mutex for long periods of time
Chris Mason [Fri, 4 Jan 2008 21:47:16 +0000 (16:47 -0500)]
Btrfs: resizer: don't hold the fs_mutex for long periods of time

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoProperly call btrfs_search_slot while shrinking
Chris Mason [Fri, 4 Jan 2008 14:34:54 +0000 (09:34 -0500)]
Properly call btrfs_search_slot while shrinking

The shrinking code used btrfs_next_leaf to find the next item, but
this does not cow the blocks it touches.  This fix calls search_slot after
finding the next item to do appropriate cow and balancing.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Lower the max inline size to 8k
Chris Mason [Thu, 3 Jan 2008 20:44:57 +0000 (15:44 -0500)]
Btrfs: Lower the max inline size to 8k

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Change st_blocksize to 4k
Chris Mason [Thu, 3 Jan 2008 19:51:00 +0000 (14:51 -0500)]
Btrfs: Change st_blocksize to 4k

Some programs (python) do rwm cycles at the granularity returned by
stat.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Properly handle overlapping extent in shrink_extent_tree
Yan [Thu, 3 Jan 2008 19:14:39 +0000 (14:14 -0500)]
Btrfs: Properly handle overlapping extent in shrink_extent_tree

The patch fixes the overlapping extent issue in shrink_extent_tree.
It checks whether there is an overlapping extent by using
find_previous_extent. If there is an overlapping extent, it setups
key.objectid and cur_byte properly.

---

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add a helper that finds previous extent item
Yan [Thu, 3 Jan 2008 18:56:30 +0000 (13:56 -0500)]
Btrfs: Add a helper that finds previous extent item

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix lock ordering of the snapshot semaphore against the page lock
Chris Mason [Thu, 3 Jan 2008 18:46:11 +0000 (13:46 -0500)]
Btrfs: Fix lock ordering of the snapshot semaphore against the page lock

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agocount_snapshots: Properly update the leaf pointer after btrfs_next_leaf
Chris Mason [Thu, 3 Jan 2008 18:23:19 +0000 (13:23 -0500)]
count_snapshots: Properly update the leaf pointer after btrfs_next_leaf

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Force inlining off in a few places to save stack usage
Chris Mason [Thu, 3 Jan 2008 15:01:48 +0000 (10:01 -0500)]
Btrfs: Force inlining off in a few places to save stack usage

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: 32 bit compile fixes for the resizer and enospc checks
Chris Mason [Thu, 3 Jan 2008 14:22:38 +0000 (09:22 -0500)]
Btrfs: 32 bit compile fixes for the resizer and enospc checks

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Reduce stack usage in the resizer, fix 32 bit compiles
Chris Mason [Thu, 3 Jan 2008 14:08:48 +0000 (09:08 -0500)]
Btrfs: Reduce stack usage in the resizer, fix 32 bit compiles

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Explicitly send a root objectid to count_snapshots_in_path
Chris Mason [Thu, 3 Jan 2008 14:08:27 +0000 (09:08 -0500)]
Btrfs: Explicitly send a root objectid to count_snapshots_in_path

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add readahead to the online shrinker, and a mount -o alloc_start= for testing
Chris Mason [Wed, 2 Jan 2008 15:01:11 +0000 (10:01 -0500)]
Btrfs: Add readahead to the online shrinker, and a mount -o alloc_start= for testing

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix NULL block groups on reading the inode
Chris Mason [Fri, 21 Dec 2007 21:36:24 +0000 (16:36 -0500)]
Btrfs: Fix NULL block groups on reading the inode

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Support for online FS resize (grow and shrink)
Chris Mason [Fri, 21 Dec 2007 21:27:24 +0000 (16:27 -0500)]
Btrfs: Support for online FS resize (grow and shrink)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix an off by one in the extent_map prepare write code
Chris Mason [Fri, 21 Dec 2007 21:27:23 +0000 (16:27 -0500)]
Btrfs: Fix an off by one in the extent_map prepare write code

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Implement basic support for -ENOSPC
Chris Mason [Fri, 21 Dec 2007 21:27:21 +0000 (16:27 -0500)]
Btrfs: Implement basic support for -ENOSPC

This is intended to prevent accidentally filling the drive.  A determined
user can still make things oops.

It includes some accounting of the current bytes under delayed allocation,
but this will change as things get optimized

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Less aggressive readahead on deletes
Chris Mason [Fri, 21 Dec 2007 21:24:26 +0000 (16:24 -0500)]
Btrfs: Less aggressive readahead on deletes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix nodatacow extent lookup
Chris Mason [Wed, 19 Dec 2007 14:11:48 +0000 (09:11 -0500)]
Btrfs: Fix nodatacow extent lookup

Yan Zheng noticed the offset into the extent was incorrectly being added to the
extent start before trying to find it in the extent allocation tree.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix delayed allocation to avoid missing delalloc extents
Chris Mason [Tue, 18 Dec 2007 21:25:45 +0000 (16:25 -0500)]
Btrfs: Fix delayed allocation to avoid missing delalloc extents

find_lock_delalloc_range could exit out too early

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agokmalloc a few large stack objects in the btrfs_ioctl path
Chris Mason [Tue, 18 Dec 2007 21:25:45 +0000 (16:25 -0500)]
kmalloc a few large stack objects in the btrfs_ioctl path

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Back port to 2.6.18-el kernels
Chris Mason [Tue, 18 Dec 2007 21:15:09 +0000 (16:15 -0500)]
Btrfs: Back port to 2.6.18-el kernels

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add mount option to enforce a max extent size
Chris Mason [Tue, 18 Dec 2007 01:14:04 +0000 (20:14 -0500)]
Btrfs: Add mount option to enforce a max extent size

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix extent_map and extent_state leaks by flushing lrus on FS unmount
Chris Mason [Tue, 18 Dec 2007 01:14:04 +0000 (20:14 -0500)]
Btrfs: Fix extent_map and extent_state leaks by flushing lrus on FS unmount

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add mount option to turn off data cow
Chris Mason [Tue, 18 Dec 2007 01:14:01 +0000 (20:14 -0500)]
Btrfs: Add mount option to turn off data cow

A number of workloads do not require copy on write data or checksumming.
mount -o nodatasum to disable checksums and -o nodatacow to disable
both copy on write and checksumming.

In nodatacow mode, copy on write is still performed when a given extent
is under snapshot.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add mount -o nodatasum to turn of file data checksumming
Chris Mason [Fri, 14 Dec 2007 20:30:32 +0000 (15:30 -0500)]
Btrfs: Add mount -o nodatasum to turn of file data checksumming

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFixes for loopback files in btrfs
Chris Mason [Fri, 14 Dec 2007 17:56:58 +0000 (12:56 -0500)]
Fixes for loopback files in btrfs

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoOff by one fix for btrfs_drop_extents
Yan [Fri, 14 Dec 2007 16:14:42 +0000 (11:14 -0500)]
Off by one fix for btrfs_drop_extents

One of my old patches introduces a new bug to
btrfs_drop_extents(changeset 275). Inline extents are not truncated
properly when "extent_end == end", it can trigger the BUG_ON at
file.c:600.  I hope I don't introduce new bug this time.

---

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Reorder extent back refs to differentiate btree blocks from file data
Chris Mason [Thu, 13 Dec 2007 16:13:32 +0000 (11:13 -0500)]
Btrfs: Reorder extent back refs to differentiate btree blocks from file data

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFix btrfs_inc_ref to add backref hints
Chris Mason [Thu, 13 Dec 2007 14:48:07 +0000 (09:48 -0500)]
Fix btrfs_inc_ref to add backref hints

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix typo in .. check (thanks Yan)
Chris Mason [Thu, 13 Dec 2007 14:06:59 +0000 (09:06 -0500)]
Btrfs: Fix typo in .. check (thanks Yan)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add backrefs for symbolic link inodes
Chris Mason [Thu, 13 Dec 2007 14:06:01 +0000 (09:06 -0500)]
Btrfs: Add backrefs for symbolic link inodes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Extra NULL block group checks in find_free_extent
Chris Mason [Thu, 13 Dec 2007 14:02:46 +0000 (09:02 -0500)]
Btrfs: Extra NULL block group checks in find_free_extent

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add back pointers from the inode to the directory that references it
Chris Mason [Wed, 12 Dec 2007 19:38:19 +0000 (14:38 -0500)]
Btrfs: Add back pointers from the inode to the directory that references it

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add lowest key information to back refs for extent tree blocks as well.
Chris Mason [Tue, 11 Dec 2007 17:42:00 +0000 (12:42 -0500)]
Btrfs: Add lowest key information to back refs for extent tree blocks as well.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add back pointers from extents to the btree or file referencing them
Chris Mason [Tue, 11 Dec 2007 14:25:06 +0000 (09:25 -0500)]
Btrfs: Add back pointers from extents to the btree or file referencing them

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Implement generation numbers in block pointers
Chris Mason [Tue, 11 Dec 2007 14:25:06 +0000 (09:25 -0500)]
Btrfs: Implement generation numbers in block pointers

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: section mismatch warnings
Christian Hesse [Tue, 11 Dec 2007 14:25:06 +0000 (09:25 -0500)]
Btrfs: section mismatch warnings

--Boundary-00=_CcOWHFYK4T+JwSj
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello everybody,

compiling btrfs into the kernel results in section mismatch warnings. __exit
functions are called where they are not allowed to. The attached patch fixes
this for me. Not sure if it is correct though.

Signed-off-by: Christian Hesse <mail@earthworm.de>
--
Regards,
Chris

--Boundary-00=_CcOWHFYK4T+JwSj
Content-Type: text/x-diff; charset="iso-8859-1";
name="btrfs-section_mismatches.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="btrfs-section_mismatches.patch"

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix buffer get/release issue in create_snapshot
Yan [Tue, 4 Dec 2007 18:20:20 +0000 (13:20 -0500)]
Btrfs: Fix buffer get/release issue in create_snapshot
btrfs_cow_block expects a reference to be held on the buffer being cow'd.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix extent allocation for btree blocks as the disk fills
Chris Mason [Tue, 4 Dec 2007 18:18:24 +0000 (13:18 -0500)]
Btrfs: Fix extent allocation for btree blocks as the disk fills

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add simple stripe size parameter
Chris Mason [Fri, 30 Nov 2007 16:30:34 +0000 (11:30 -0500)]
Btrfs: Add simple stripe size parameter

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs_drop_extents: make sure the item is getting smaller before truncate
Chris Mason [Fri, 30 Nov 2007 15:09:33 +0000 (10:09 -0500)]
btrfs_drop_extents: make sure the item is getting smaller before truncate

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add efficient dirty accounting to the extent_map tree
Chris Mason [Tue, 27 Nov 2007 16:16:35 +0000 (11:16 -0500)]
Btrfs: Add efficient dirty accounting to the extent_map tree

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fine tune the btree writeback exclusion some more
Chris Mason [Tue, 27 Nov 2007 15:52:01 +0000 (07:52 -0800)]
Btrfs: Fine tune the btree writeback exclusion some more

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Only limit btree writeback for pdflush
Chris Mason [Tue, 27 Nov 2007 00:47:05 +0000 (19:47 -0500)]
Btrfs: Only limit btree writeback for pdflush

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Limit btree writeback to prevent seeks
Chris Mason [Tue, 27 Nov 2007 00:34:41 +0000 (16:34 -0800)]
Btrfs: Limit btree writeback to prevent seeks

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Handle writeback under high memory pressure better
Chris Mason [Tue, 27 Nov 2007 00:15:16 +0000 (16:15 -0800)]
Btrfs: Handle writeback under high memory pressure better

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Properly update right_nritems in push_leaf_left
Yan [Mon, 26 Nov 2007 15:58:13 +0000 (10:58 -0500)]
Btrfs: Properly update right_nritems in push_leaf_left

The codes that fixup the right leaf and the codes that dirty the
extnet buffer use the variable 'right_nritems' ,  both of them expect
'right_nritems' is the number of items in right leaf after the push.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add check for null block group to find_search_start
Chris Mason [Mon, 26 Nov 2007 15:55:49 +0000 (10:55 -0500)]
Btrfs: Add check for null block group to find_search_start

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Make sure page mapping dirty tag is properly cleared
Chris Mason [Tue, 20 Nov 2007 18:44:45 +0000 (13:44 -0500)]
Btrfs: Make sure page mapping dirty tag is properly cleared

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Avoid fragmentation from parallel delalloc filling
Chris Mason [Tue, 20 Nov 2007 15:47:25 +0000 (10:47 -0500)]
Btrfs: Avoid fragmentation from parallel delalloc filling

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Return value checking in module init
Wyatt Banks [Mon, 19 Nov 2007 15:22:33 +0000 (10:22 -0500)]
Btrfs: Return value checking in module init

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: xattr fixes
Josef Bacik [Mon, 19 Nov 2007 15:18:19 +0000 (10:18 -0500)]
Btrfs: xattr fixes

This fixes two typos that Yan pointed out to me.  Thanks much,

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Make ACLs return EOPNOTSUPP for now
Josef Bacik [Mon, 19 Nov 2007 15:18:17 +0000 (10:18 -0500)]
Btrfs: Make ACLs return EOPNOTSUPP for now

There was a slight problem with ACL's returning EINVAL when you tried to set an
ACL.  This isn't correct, we should be returning EOPNOTSUPP, so I did a very
ugly thing and just commented everybody out and made them return EOPNOTSUPP.
This is only temporary, I'm going back to implement ACL's, but Chris wants to
push out a release so this will suffice for now.

Also Yan suggested setting reada to -1 in the delete case to enable backwards
readahead, and in the listxattr case I moved path->reada = 2; to after the if
(!path) check so we can avoid a possible null dereference.  Thank you,

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Off by one fixes for extent-tree.c
Yan [Fri, 16 Nov 2007 19:57:09 +0000 (14:57 -0500)]
Btrfs: Off by one fixes for extent-tree.c

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add full_scan parameter to find_search_start
Yan [Fri, 16 Nov 2007 19:57:09 +0000 (14:57 -0500)]
Btrfs: Add full_scan parameter to find_search_start

This patch adds a new parameter 'full_scan' to 'find_search_start',
thereby 'find_search_start' can know whether 'find_free_extent' is in
full scan phrase. I feel that 'find_search_start' should skip calling
'btrfs_find_block_group' when 'find_free_extent' is in full scan
phrase. In my test on a 2GB volume, Oops occurs when space usage is
about 76%. After apply the patch,  Oops occurs when space usage is
near 100%.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add block group pinned accounting back
Yan [Fri, 16 Nov 2007 19:57:08 +0000 (14:57 -0500)]
Btrfs: Add block group pinned accounting back

This patch adds a helper function 'update_pinned_extents' to
extent-tree.c. The usage of the helper function is similar to
'update_block_group',  the last parameter of the function indicates
pin vs unpin.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoxattr support for btrfs
Josef Bacik [Fri, 16 Nov 2007 16:45:54 +0000 (11:45 -0500)]
xattr support for btrfs

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix extent bit range testing
Chris Mason [Sun, 11 Nov 2007 13:22:00 +0000 (08:22 -0500)]
Btrfs: Fix extent bit range testing

It could return the bit as set when there was actually a hole at the
very end of the range.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add readpages support
Chris Mason [Thu, 8 Nov 2007 15:59:22 +0000 (10:59 -0500)]
Btrfs: Add readpages support

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Avoid extent_buffer lru corruption
Chris Mason [Thu, 8 Nov 2007 15:59:05 +0000 (10:59 -0500)]
Btrfs: Avoid extent_buffer lru corruption

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Allow large data extents in a single file to span into metadata block groups
Chris Mason [Thu, 8 Nov 2007 02:08:16 +0000 (21:08 -0500)]
Btrfs: Allow large data extents in a single file to span into metadata block groups

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix failure cleanups when allocating extent buffers fail
Chris Mason [Thu, 8 Nov 2007 02:08:16 +0000 (21:08 -0500)]
Btrfs: Fix failure cleanups when allocating extent buffers fail

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Use writepages for the metadata too
Chris Mason [Thu, 8 Nov 2007 02:08:01 +0000 (21:08 -0500)]
Btrfs: Use writepages for the metadata too

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoProperly delete csum item in btrfs_truncate_in_trans.
Yan [Wed, 7 Nov 2007 18:31:09 +0000 (13:31 -0500)]
Properly delete csum item in btrfs_truncate_in_trans.

When 'item_end' is equal to 'inode->i_size',   'found_type' is updated
and current item is skipped. This behavior is correct for extent item,
but incorrect for csum item. For example, there is a csum item with
'offset == 0'. When deleting the inode,  'inode->i_size' is set to 0,
so the csum item isn't deleted.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Change push_leaf_{leaf,right} to empty the src leave during item deletion
Chris Mason [Wed, 7 Nov 2007 18:31:03 +0000 (13:31 -0500)]
Btrfs: Change push_leaf_{leaf,right} to empty the src leave during item deletion

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFix recursive KM_USER1 usage in btrfs_realloc_node
Chris Mason [Tue, 6 Nov 2007 20:09:29 +0000 (15:09 -0500)]
Fix recursive KM_USER1 usage in btrfs_realloc_node

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Optimize allocations as we need to mix data and metadata into one group
Chris Mason [Tue, 6 Nov 2007 15:26:29 +0000 (10:26 -0500)]
Btrfs: Optimize allocations as we need to mix data and metadata into one group

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFix EXTENT_MAP_INLINE off by one in btrfs_drop_extents
Yan [Tue, 6 Nov 2007 15:26:28 +0000 (10:26 -0500)]
Fix EXTENT_MAP_INLINE off by one in btrfs_drop_extents

Don't set hint_byte to EXTENT_MAP_INLINE when 'end == extent_end' or
'start == key.offset' . The inline extent will be truncated in these
cases.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix u32 overflow in dirty_and_release_pages.
Yan [Tue, 6 Nov 2007 15:26:26 +0000 (10:26 -0500)]
Btrfs: Fix u32 overflow in dirty_and_release_pages.

When calculating the size of inline extent,  inode->i_size should also
be take into consideration, otherwise sys_write may drop some data
silently.  You can test this bug by:

#dd if=/dev/zero bs=4k count=1 of=test_file
#dd if=/dev/zero bs=2k count=1 of=test_file conv=notrunc

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Make defrag check nodes against the progress key to prevent repeating work
Chris Mason [Tue, 6 Nov 2007 15:26:24 +0000 (10:26 -0500)]
Btrfs: Make defrag check nodes against the progress key to prevent repeating work

Signed-off-by: Chris Mason <chris.mason@oracle.com>
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>