openwrt/staging/blogic.git
16 years agoBtrfs: Make an unplug function that doesn't unplug every spindle
Chris Mason [Mon, 21 Apr 2008 14:03:05 +0000 (10:03 -0400)]
Btrfs: Make an unplug function that doesn't unplug every spindle

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Remove debugging statements from the invalidatepage calls
Chris Mason [Mon, 21 Apr 2008 12:52:50 +0000 (08:52 -0400)]
Btrfs: Remove debugging statements from the invalidatepage calls

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add 1MB to the min_free in alloc_chunk
Chris Mason [Mon, 21 Apr 2008 12:28:10 +0000 (08:28 -0400)]
Btrfs: Add 1MB to the min_free in alloc_chunk

This properly reflects the first 1MB we skip at the start of the device

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Scale the bdi ra_pages by the number of devices in the FS
Chris Mason [Fri, 18 Apr 2008 20:13:31 +0000 (16:13 -0400)]
Btrfs: Scale the bdi ra_pages by the number of devices in the FS

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoForce page->private removal in btrfs_invalidatepage
Chris Mason [Fri, 18 Apr 2008 20:11:30 +0000 (16:11 -0400)]
Force page->private removal in btrfs_invalidatepage

btrfs_invalidatepage is not allowed to leave pages around on the lru.
Any such pages will trigger an oops later on because the VM will see
page->private and assume it is a buffer head.

This also forces extra flushes of the async work queues before
dropping all the pages on the btree inode during unmount.  Left over
items on the work queues are one possible cause of busy state ranges
during truncate_inode_pages.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Set the btree inode i_size to OFFSET_MAX
Chris Mason [Fri, 18 Apr 2008 18:17:20 +0000 (14:17 -0400)]
Btrfs: Set the btree inode i_size to OFFSET_MAX

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix chunk allocation when some devices don't have enough room for stripes
Chris Mason [Fri, 18 Apr 2008 15:55:51 +0000 (11:55 -0400)]
Btrfs: Fix chunk allocation when some devices don't have enough room for stripes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Calculate appropriate chunk sizes for both small and large filesystems
Chris Mason [Fri, 18 Apr 2008 14:29:51 +0000 (10:29 -0400)]
Btrfs: Calculate appropriate chunk sizes for both small and large filesystems

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Don't drop extent_map cache during releasepage on the btree inode
Chris Mason [Fri, 18 Apr 2008 14:29:50 +0000 (10:29 -0400)]
Btrfs: Don't drop extent_map cache during releasepage on the btree inode

The btree inode should only have a single extent_map in the cache,
it doesn't make sense to ever drop it.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add support for labels in the super block
Chris Mason [Fri, 18 Apr 2008 14:29:49 +0000 (10:29 -0400)]
Btrfs: Add support for labels in the super block

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Check device uuids along with devids
Chris Mason [Fri, 18 Apr 2008 14:29:38 +0000 (10:29 -0400)]
Btrfs: Check device uuids along with devids

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Remove bogus max_sector warnings from the extent_io code
Chris Mason [Thu, 17 Apr 2008 18:08:30 +0000 (14:08 -0400)]
Btrfs: Remove bogus max_sector warnings from the extent_io code

It was testing the bio before doing logical->physical mapping, so the
test was always wrong.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Avoid 64 bit div for RAID10
Chris Mason [Thu, 17 Apr 2008 15:58:30 +0000 (11:58 -0400)]
Btrfs: Avoid 64 bit div for RAID10

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Use the extent map cache to find the logical disk block during data retries
Chris Mason [Thu, 17 Apr 2008 15:29:12 +0000 (11:29 -0400)]
Btrfs: Use the extent map cache to find the logical disk block during data retries

The data read retry code needs to find the logical disk block before it
can resubmit new bios.  But, finding this block isn't allowed to take
the fs_mutex because that will deadlock with a number of different callers.

This changes the retry code to use the extent map cache instead, but
that requires the extent map cache to have the extent we're looking for.
This is a problem because btrfs_drop_extent_cache just drops the entire
extent instead of the little tiny part it is invalidating.

The bulk of the code in this patch changes btrfs_drop_extent_cache to
invalidate only a portion of the extent cache, and changes btrfs_get_extent
to deal with the results.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Only do async bio submission for pdflush
Chris Mason [Wed, 16 Apr 2008 17:06:16 +0000 (13:06 -0400)]
Btrfs: Only do async bio submission for pdflush

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Don't wait on tree block writeback before freeing them anymore
Chris Mason [Wed, 16 Apr 2008 16:59:22 +0000 (12:59 -0400)]
Btrfs: Don't wait on tree block writeback before freeing them anymore

This isn't required anymore because we don't reallocate blocks that
have already been written in this transaction.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Write bio checksumming outside the FS mutex
Chris Mason [Wed, 16 Apr 2008 15:15:20 +0000 (11:15 -0400)]
Btrfs: Write bio checksumming outside the FS mutex

This significantly improves streaming write performance by allowing
concurrency in the data checksumming.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Create a work queue for bio writes
Chris Mason [Wed, 16 Apr 2008 15:14:51 +0000 (11:14 -0400)]
Btrfs: Create a work queue for bio writes

This allows checksumming to happen in parallel among many cpus, and
keeps us from bogging down pdflush with the checksumming code.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add RAID10 support
Chris Mason [Wed, 16 Apr 2008 14:49:51 +0000 (10:49 -0400)]
Btrfs: Add RAID10 support

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add chunk uuids and update multi-device back references
Chris Mason [Tue, 15 Apr 2008 19:41:47 +0000 (15:41 -0400)]
Btrfs: Add chunk uuids and update multi-device back references

Block headers now store the chunk tree uuid

Chunk items records the device uuid for each stripes

Device extent items record better back refs to the chunk tree

Block groups record better back refs to the chunk tree

The chunk tree format has also changed.  The objectid of BTRFS_CHUNK_ITEM_KEY
used to be the logical offset of the chunk.  Now it is a chunk tree id,
with the logical offset being stored in the offset field of the key.

This allows a single chunk tree to record multiple logical address spaces,
upping the number of bytes indexed by a chunk tree from 2^64 to
2^128.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: A few updates for 2.6.18 and versions older than 2.6.25
Chris Mason [Mon, 14 Apr 2008 13:48:18 +0000 (09:48 -0400)]
Btrfs: A few updates for 2.6.18 and versions older than 2.6.25

This includes fixing a missing spinlock init call that caused oops on mount
for most kernels other than 2.6.25.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoAdd a min size parameter to btrfs_alloc_extent
Chris Mason [Mon, 14 Apr 2008 13:46:10 +0000 (09:46 -0400)]
Add a min size parameter to btrfs_alloc_extent

On huge machines, delayed allocation may try to allocate massive extents.
This change allows btrfs_alloc_extent to return something smaller than
the caller asked for, and the data allocation routines will loop over
the allocations until it fills the whole delayed alloc.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: bio_endio support for linux 2.6.23 and older.
Miguel [Fri, 11 Apr 2008 19:50:59 +0000 (15:50 -0400)]
Btrfs: bio_endio support for linux 2.6.23 and older.

bio_endio() changed prototype on linux 2.6.24, support older kernels
using the older prototype.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: define write_cache_pages for linux kernel <= 2.6.20 instead
Miguel [Fri, 11 Apr 2008 19:46:48 +0000 (15:46 -0400)]
Btrfs: define write_cache_pages for linux kernel <= 2.6.20 instead

write_cache_pages doesn't exist in linux 2.6.20,  change the #if
condition to match that.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Endianess bug fix for v0.13 with kernels
Miguel [Fri, 11 Apr 2008 19:45:51 +0000 (15:45 -0400)]
Btrfs: Endianess bug fix for v0.13 with kernels

Fix for a endianess BUG when using btrfs v0.13 with kernels older than 2.6.23

Problem:

Has of v0.13, btrfs-progs is using crc32c.c equivalent to the one found on
linux-2.6.23/lib/libcrc32c.c Since crc32c_le() changed in linux-2.6.23, when
running btrfs v0.13 with older kernels we have a missmatch between the versions
of crc32c_le() from btrfs-progs and libcrc32c in the kernel.  This missmatch
causes a bug when using btrfs on big endian machines.

Solution:
btrfs_crc32c() macro that when compiling for kernels older than 2.6.23, does
endianess conversion to parameters and return value of crc32c().
This endianess conversion nullifies the differences in implementation
of crc32c_le().
If kernel 2.6.23 or better, it calls crc32c().

Signed-off-by: Miguel Sousa Filipe <miguel.filipe@gmail.com>
---

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fixup a few u64<->pointer casts for 32 bit
Chris Mason [Fri, 11 Apr 2008 16:16:46 +0000 (12:16 -0400)]
Btrfs: Fixup a few u64<->pointer casts for 32 bit

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add extra checks to avoid removing extent_state from pages we can't free
Chris Mason [Fri, 11 Apr 2008 14:51:07 +0000 (10:51 -0400)]
Btrfs: Add extra checks to avoid removing extent_state from pages we can't free

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Write out all super blocks on commit, and bring back proper barrier support
Chris Mason [Thu, 10 Apr 2008 20:19:33 +0000 (16:19 -0400)]
Btrfs: Write out all super blocks on commit, and bring back proper barrier support

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add O_DIRECT read and write (writes == buffered + cache flush)
Chris Mason [Thu, 10 Apr 2008 14:23:21 +0000 (10:23 -0400)]
Btrfs: Add O_DIRECT read and write (writes == buffered + cache flush)

This adds basic O_DIRECT read and write support.  In the write case, we
just do a normal buffered write followed by a cache flush.  O_DIRECT +
O_SYNC are required to trigger metadata syncs.

In the read case, there is a basic btrfs_get_block call for use by
the generic O_DIRECT code.  This does honor multi-volume mapping rules
but it skips all checksumming.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Disable extra debugging checks on tree blocks
Chris Mason [Thu, 10 Apr 2008 14:23:19 +0000 (10:23 -0400)]
Btrfs: Disable extra debugging checks on tree blocks

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Handle checksumming errors while reading data blocks
Chris Mason [Wed, 9 Apr 2008 20:28:12 +0000 (16:28 -0400)]
Btrfs: Handle checksumming errors while reading data blocks

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Retry metadata reads in the face of checksum failures
Chris Mason [Wed, 9 Apr 2008 20:28:12 +0000 (16:28 -0400)]
Btrfs: Retry metadata reads in the face of checksum failures

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Handle data block end_io through the async work queue
Chris Mason [Wed, 9 Apr 2008 20:28:12 +0000 (16:28 -0400)]
Btrfs: Handle data block end_io through the async work queue

Before it was done by the bio end_io routine, the work queue code is able
to scale much better with faster IO subsystems.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Do metadata checksums for reads via a workqueue
Chris Mason [Wed, 9 Apr 2008 20:28:12 +0000 (16:28 -0400)]
Btrfs: Do metadata checksums for reads via a workqueue

Before, metadata checksumming was done by the callers of read_tree_block,
which would set EXTENT_CSUM bits in the extent tree to show that a given
range of pages was already checksummed and didn't need to be verified
again.

But, those bits could go away via try_to_releasepage, and the end
result was bogus checksum failures on pages that never left the cache.

The new code validates checksums when the page is read.  It is a little
tricky because metadata blocks can span pages and a single read may
end up going via multiple bios.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add additional debugging for metadata checksum failures
Chris Mason [Wed, 9 Apr 2008 20:28:12 +0000 (16:28 -0400)]
Btrfs: Add additional debugging for metadata checksum failures

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoChange btrfs_map_block to return a structure with mappings for all stripes
Chris Mason [Wed, 9 Apr 2008 20:28:12 +0000 (16:28 -0400)]
Change btrfs_map_block to return a structure with mappings for all stripes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix allocation profile init
Chris Mason [Fri, 4 Apr 2008 19:40:00 +0000 (15:40 -0400)]
Btrfs: Fix allocation profile init

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Don't allow written blocks from this transaction to be reallocated
Chris Mason [Fri, 4 Apr 2008 19:40:00 +0000 (15:40 -0400)]
Btrfs: Don't allow written blocks from this transaction to be reallocated

When a block is freed, it can be immediately reused if it is from
the current transaction.  But, an extra check is required to make sure
the block had not been written yet.  If it were reused after being written,
the transid in the block header might match the transid of the
next time the block was allocated.

The parent node records the transaction ID of the block it is pointing to,
and this is used as part of validating the block on reads.  So, there
can only be one version of a block per transaction.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add support for duplicate blocks on a single spindle
Chris Mason [Thu, 3 Apr 2008 20:29:03 +0000 (16:29 -0400)]
Btrfs: Add support for duplicate blocks on a single spindle

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add support for mirroring across drives
Chris Mason [Thu, 3 Apr 2008 20:29:03 +0000 (16:29 -0400)]
Btrfs: Add support for mirroring across drives

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Properly dirty buffers in the split corner cases
Chris Mason [Thu, 3 Apr 2008 20:29:02 +0000 (16:29 -0400)]
Btrfs: Properly dirty buffers in the split corner cases

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Verify checksums on tree blocks found without read_tree_block
Chris Mason [Tue, 1 Apr 2008 17:48:14 +0000 (13:48 -0400)]
Btrfs: Verify checksums on tree blocks found without read_tree_block

Checksums were only verified by btrfs_read_tree_block, which meant the
functions to probe the page cache for blocks were not validating checksums.
Normally this is fine because the buffers will only be in cache if they
have already been validated.

But, there is a window while the buffer is being read from disk where
it could be up to date in the cache but not yet verified.  This patch
makes sure all buffers go through checksum verification before they
are used.

This is safer, and it prevents modification of buffers before they go
through the csum code.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Keep fs_mutex during reads done by snapshot deletion
Chris Mason [Tue, 1 Apr 2008 15:26:07 +0000 (11:26 -0400)]
Btrfs: Keep fs_mutex during reads done by snapshot deletion

There was an optimization to drop the fs_mutex when doing snapshot deletion
reads, but this can lead to false positives on checksumming errors.  Keep
the lock for now.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs-progs: Stop stomping on 'name' input parameter
Alex Chiang [Tue, 1 Apr 2008 15:21:40 +0000 (11:21 -0400)]
btrfs-progs: Stop stomping on 'name' input parameter

In btrfs_name_hash, Local variable 'buf' is declared as

__u32 buf[2];

but we then try to do this:

buf[0] = 0x67452301;
buf[1] = 0xefcdab89;
buf[2] = 0x98badcfe;
buf[3] = 0x10325476;

Oops. Fix buf to be the proper size.

Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Correct usage of IS_ERR() in extent_io.c
Peter [Tue, 1 Apr 2008 15:21:40 +0000 (11:21 -0400)]
Btrfs: Correct usage of IS_ERR() in extent_io.c

Signed-off-by: Peter Teoh <htmldeveloper@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFix btrfs_fill_super to return -EINVAL when no FS found
Yan [Tue, 1 Apr 2008 15:21:34 +0000 (11:21 -0400)]
Fix btrfs_fill_super to return -EINVAL when no FS found

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoReorder the flags field in struct btrfs_header and record a flag on writeout
Chris Mason [Tue, 1 Apr 2008 15:21:32 +0000 (11:21 -0400)]
Reorder the flags field in struct btrfs_header and record a flag on writeout

This allows detection of blocks that have already been written in the
running transaction so they can be recowed instead of modified again.
It is step one in trusting the transid field of the block pointers.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add leak debugging for extent_buffer and extent_state
Chris Mason [Wed, 26 Mar 2008 20:24:23 +0000 (16:24 -0400)]
Btrfs: Add leak debugging for extent_buffer and extent_state

This also fixes one leak around the super block when failing to mount the
FS.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Use a higher default ra pages
Chris Mason [Wed, 26 Mar 2008 16:02:55 +0000 (12:02 -0400)]
Btrfs: Use a higher default ra pages

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoCreate a btrfs backing dev info
Chris Mason [Wed, 26 Mar 2008 14:28:07 +0000 (10:28 -0400)]
Create a btrfs backing dev info

This allows intelligent versions of unplug and congestion functions

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Implement raid0 when multiple devices are present
Chris Mason [Tue, 25 Mar 2008 20:50:33 +0000 (16:50 -0400)]
Btrfs: Implement raid0 when multiple devices are present

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add support for device scanning and detection ioctls
Chris Mason [Mon, 24 Mar 2008 19:02:07 +0000 (15:02 -0400)]
Btrfs: Add support for device scanning and detection ioctls

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Bring back mount -o ssd optimizations
Chris Mason [Mon, 24 Mar 2008 19:02:07 +0000 (15:02 -0400)]
Btrfs: Bring back mount -o ssd optimizations

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Move device information into the super block so it can be scanned
Chris Mason [Mon, 24 Mar 2008 19:02:07 +0000 (15:02 -0400)]
Btrfs: Move device information into the super block so it can be scanned

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Make the FS tree the last objectid in the tree of tree roots
Chris Mason [Mon, 24 Mar 2008 19:02:07 +0000 (15:02 -0400)]
Btrfs: Make the FS tree the last objectid in the tree of tree roots

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoAdd /dev/btrfs-control for device scanning ioctls
Chris Mason [Mon, 24 Mar 2008 19:02:04 +0000 (15:02 -0400)]
Add /dev/btrfs-control for device scanning ioctls

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Bring back find_free_extent CPU usage optimizations
Chris Mason [Mon, 24 Mar 2008 19:02:03 +0000 (15:02 -0400)]
Btrfs: Bring back find_free_extent CPU usage optimizations

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Dynamic chunk and block group allocation
Chris Mason [Mon, 24 Mar 2008 19:01:59 +0000 (15:01 -0400)]
Btrfs: Dynamic chunk and block group allocation

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add support for multiple devices per filesystem
Chris Mason [Mon, 24 Mar 2008 19:01:56 +0000 (15:01 -0400)]
Btrfs: Add support for multiple devices per filesystem

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoMatch the extent tree code to btrfs-progs for multi-device merging
Chris Mason [Mon, 24 Mar 2008 19:01:28 +0000 (15:01 -0400)]
Match the extent tree code to btrfs-progs for multi-device merging

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Use KM_USERN instead of KM_IRQ during data summing
Chris Mason [Thu, 21 Feb 2008 14:30:08 +0000 (09:30 -0500)]
Btrfs: Use KM_USERN instead of KM_IRQ during data summing

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Disable sysfs files on older kernels
Chris Mason [Wed, 20 Feb 2008 21:02:51 +0000 (16:02 -0500)]
Btrfs: Disable sysfs files on older kernels

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Make sure bio pages are adjacent during bulk csumming
Chris Mason [Wed, 20 Feb 2008 20:44:32 +0000 (15:44 -0500)]
Btrfs: Make sure bio pages are adjacent during bulk csumming

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Misc 2.6.25 updates
Chris Mason [Wed, 20 Feb 2008 21:11:05 +0000 (16:11 -0500)]
Btrfs: Misc 2.6.25 updates

Remove the btrfs read_inode method, and use save_mount_options

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs: fixes for kobject changes in mainline
Greg KH [Wed, 20 Feb 2008 19:14:16 +0000 (14:14 -0500)]
btrfs: fixes for kobject changes in mainline

Here's a patch against the unstable tree that gets the code to build
against Linus's current tree (2.6.24-git12).  This is needed as the
kobject/kset api has changed there.

I tried to make the smallest changes needed, and it builds and loads
successfully, but I don't have a btrfs volume anywhere (yet) to try to
see if things still work properly :)

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: While doing checksums on bios, cache the extent_buffer mapping
Chris Mason [Wed, 20 Feb 2008 17:07:25 +0000 (12:07 -0500)]
Btrfs: While doing checksums on bios, cache the extent_buffer mapping

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: checksum file data at bio submission time instead of during writepage
Chris Mason [Wed, 20 Feb 2008 17:07:25 +0000 (12:07 -0500)]
Btrfs: checksum file data at bio submission time instead of during writepage

When we checkum file data during writepage, the checksumming is done one
page at a time, making it difficult to do bulk metadata modifications
to insert checksums for large ranges of the file at once.

This patch changes btrfs to checksum on a per-bio basis instead.  The
bios are checksummed before they are handed off to the block layer, so
each bio is contiguous and only has pages from the same inode.

Checksumming on a bio basis allows us to insert and modify the file
checksum items in large groups.  It also allows the checksumming to
be done more easily by async worker threads.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Properly cast before shifting
Chris Mason [Tue, 19 Feb 2008 21:24:18 +0000 (16:24 -0500)]
Btrfs: Properly cast before shifting

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Take the extent lock before dropping the delalloc bits
Chris Mason [Tue, 19 Feb 2008 17:55:05 +0000 (12:55 -0500)]
Btrfs: Take the extent lock before dropping the delalloc bits

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix looping on readdir of the subvol roots
Yan Zheng [Tue, 19 Feb 2008 16:41:02 +0000 (11:41 -0500)]
Btrfs: Fix looping on readdir of the subvol roots

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Properly clear dirty and delalloc extent bits while preparing the file for...
Chris Mason [Tue, 19 Feb 2008 16:29:24 +0000 (11:29 -0500)]
Btrfs: Properly clear dirty and delalloc extent bits while preparing the file for write

Yan Zheng noticed that we don't clear the extent state tree dirty and delalloc
bits when we clear the dirty bits on the page during file write.

This leads to csum errors later on.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Remove extent back refs in batches, and avoid duplicate searches
Chris Mason [Mon, 18 Feb 2008 21:33:44 +0000 (16:33 -0500)]
Btrfs: Remove extent back refs in batches, and avoid duplicate searches

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Allocator improvements
Chris Mason [Mon, 18 Feb 2008 17:12:38 +0000 (12:12 -0500)]
Btrfs: Allocator improvements

Reduce CPU time searching for free blocks by optimizing find_first_extent_bit

Fix find_free_extent to make better use of the last_alloc hint.  Before it
was often finding blocks just before the hint.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Disable tree defrag in SSD mode
Chris Mason [Fri, 15 Feb 2008 18:19:35 +0000 (13:19 -0500)]
Btrfs: Disable tree defrag in SSD mode

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: unaligned access fixes
David Miller [Fri, 15 Feb 2008 15:40:52 +0000 (10:40 -0500)]
Btrfs: unaligned access fixes

Btrfs set/get macros lose type information needed to avoid
unaligned accesses on sparc64.
ere is a patch for the kernel bits which fixes most of the
unaligned accesses on sparc64.

btrfs_name_hash is modified to return the hash value instead
of getting a return location via a (potentially unaligned)
pointer.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix "no csum found for inode" issue.
Yan [Fri, 15 Feb 2008 15:40:50 +0000 (10:40 -0500)]
Btrfs: Fix "no csum found for inode" issue.

A few codes were not properly updated for changes of extent map.  This
may be the causes of "no csum found for inode" issue.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix i_blocks accounting
Chris Mason [Fri, 8 Feb 2008 18:49:28 +0000 (13:49 -0500)]
Btrfs: Fix i_blocks accounting

Now that delayed allocation accounting works, i_blocks accounting is changed
to only modify i_blocks when extents inserted or removed.

The fillattr call is changed to include the delayed allocation byte count
in the i_blocks result.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Create larger bios for btree blocks
Chris Mason [Thu, 7 Feb 2008 15:50:54 +0000 (10:50 -0500)]
Btrfs: Create larger bios for btree blocks

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Don't case unsigned long to int in bio submission
Chris Mason [Wed, 6 Feb 2008 16:01:42 +0000 (11:01 -0500)]
Btrfs: Don't case unsigned long to int in bio submission

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Use 2MB as the empty_size for clustered allocations
Chris Mason [Wed, 6 Feb 2008 15:00:57 +0000 (10:00 -0500)]
Btrfs: Use 2MB as the empty_size for clustered allocations

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs_drop_extents: handle BTRFS_INODE_REF_KEY types
Yan [Tue, 5 Feb 2008 20:40:36 +0000 (15:40 -0500)]
btrfs_drop_extents: handle BTRFS_INODE_REF_KEY types
It's possible "key.type == BTRFS_INODE_REF_KEY" and "key.offset >= end".

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add checks for last byte in disk to allocator grouping
Chris Mason [Tue, 5 Feb 2008 15:20:17 +0000 (10:20 -0500)]
Btrfs: Add checks for last byte in disk to allocator grouping

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix hole creation in file_write
Yan [Tue, 5 Feb 2008 14:07:49 +0000 (09:07 -0500)]
Btrfs: Fix hole creation in file_write

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Update magic
Chris Mason [Mon, 4 Feb 2008 15:10:43 +0000 (10:10 -0500)]
Btrfs: Update magic

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add debugging for block group update failure
Chris Mason [Mon, 4 Feb 2008 15:10:13 +0000 (10:10 -0500)]
Btrfs: Add debugging for block group update failure

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix typo in extent_io.c
Yan [Mon, 4 Feb 2008 13:57:25 +0000 (08:57 -0500)]
Btrfs: Fix typo in extent_io.c
---

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Lower stack usage in transaction.c
Chris Mason [Fri, 1 Feb 2008 21:35:04 +0000 (16:35 -0500)]
Btrfs: Lower stack usage in transaction.c

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Fix delalloc account on state deletion
Chris Mason [Fri, 1 Feb 2008 20:42:15 +0000 (15:42 -0500)]
Btrfs: Fix delalloc account on state deletion

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoCall btrfs_cow_block while lowering tree level.
Yan [Fri, 1 Feb 2008 19:58:07 +0000 (14:58 -0500)]
Call btrfs_cow_block while lowering tree level.

When freeing root block of a tree,  btrfs_free_extent' parameter
'ref_generation' is from root block itseft.  When freeing non-root
block,  'ref_generation' is from its parent. so when converting a
non-root block to root block, we must guarantee its generation is
equal to its parent's generation.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Use last_alloc optimizations for metadata, even without -o ssd
Chris Mason [Fri, 1 Feb 2008 19:51:59 +0000 (14:51 -0500)]
Btrfs: Use last_alloc optimizations for metadata, even without -o ssd

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Hash in the offset and owner for file extent backref keys
Chris Mason [Fri, 1 Feb 2008 19:51:59 +0000 (14:51 -0500)]
Btrfs: Hash in the offset and owner for file extent backref keys

This makes searches for backrefs and backref insertion much more efficient
when there are many backrefs for a single extent

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Insert extent record and the first backref in a single balance
Chris Mason [Fri, 1 Feb 2008 19:51:59 +0000 (14:51 -0500)]
Btrfs: Insert extent record and the first backref in a single balance

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add a lookup cache to the extent state tree
Chris Mason [Fri, 1 Feb 2008 19:51:59 +0000 (14:51 -0500)]
Btrfs: Add a lookup cache to the extent state tree

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Add data block hints to SSD mode too
Chris Mason [Thu, 31 Jan 2008 21:45:07 +0000 (16:45 -0500)]
Btrfs: Add data block hints to SSD mode too

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Enable delalloc accounting
Chris Mason [Thu, 31 Jan 2008 16:05:37 +0000 (11:05 -0500)]
Btrfs: Enable delalloc accounting

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agobtrfs_drop_extent fixe for inline items > 8K
Yan [Wed, 30 Jan 2008 19:39:54 +0000 (14:39 -0500)]
btrfs_drop_extent fixe for inline items > 8K

When truncating a inline extent, btrfs_drop_extents doesn't properly
handle the case "key.offset > inline_limit". This bug can only happen
when max line size is larger than 8K.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoFix hole start calculation in btrfs_settar
Chris Mason [Wed, 30 Jan 2008 19:33:02 +0000 (14:33 -0500)]
Fix hole start calculation in btrfs_settar

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoProperly align the hole size in btrfs_setattr
Chris Mason [Wed, 30 Jan 2008 16:54:05 +0000 (11:54 -0500)]
Properly align the hole size in btrfs_setattr

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Align extent length to sectorsize in
Yan [Wed, 30 Jan 2008 16:54:04 +0000 (11:54 -0500)]
Btrfs: Align extent length to sectorsize in

---

Signed-off-by: Chris Mason <chris.mason@oracle.com>
16 years agoBtrfs: Copy correct tree when inserting into slot 0
Chris Mason [Wed, 30 Jan 2008 16:43:54 +0000 (11:43 -0500)]
Btrfs: Copy correct tree when inserting into slot 0

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