aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Btrfs: Add support for online device removalChris Mason2008-09-258-122/+412
| | | | | | | | | | | | | This required a few structural changes to the code that manages bdev pointers: The VFS super block now gets an anon-bdev instead of a pointer to the lowest bdev. This allows us to avoid swapping the super block bdev pointer around at run time. The code to read in the super block no longer goes through the extent buffer interface. Things got ugly keeping the mapping constant. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix clone ioctl to not hold the path over insertsChris Mason2008-09-251-32/+47
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Silence bogus inode.c compiler warningsChris Mason2008-09-251-2/+2
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add workaround for AppArmor changing remove_suid()Jeff Mahoney2008-09-252-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In openSUSE 10.3, AppArmor modifies remove_suid to take a struct path rather than just a dentry. This patch tests that the kernel is openSUSE 10.3 or newer and adjusts the call accordingly. Debian/Ubuntu with AppArmor applied will also need a similar patch. Maintainers of btrfs under those distributions should build on this patch or, alternatively, alter their package descriptions to add -DREMOVE_SUID_PATH to the compiler command line. Signed-off-by: Jeff Mahoney <jeffm@suse.com> - --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ b/compat.h 2008-02-06 16:46:13.000000000 -0500 @@ -0,0 +1,15 @@ +#ifndef _COMPAT_H_ +#define _COMPAT_H_ + + +/* + * Even if AppArmor isn't enabled, it still has different prototypes. + * Add more distro/version pairs here to declare which has AppArmor applied. + */ +#if defined(CONFIG_SUSE_KERNEL) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) +# define REMOVE_SUID_PATH 1 +# endif +#endif + +#endif /* _COMPAT_H_ */ - --- a/file.c 2008-02-06 11:37:39.000000000 -0500 +++ b/file.c 2008-02-06 16:46:23.000000000 -0500 @@ -37,6 +37,7 @@ #include "ordered-data.h" #include "ioctl.h" #include "print-tree.h" +#include "compat.h" static int btrfs_copy_from_user(loff_t pos, int num_pages, int write_bytes, @@ -790,7 +791,11 @@ static ssize_t btrfs_file_write(struct f goto out_nolock; if (count == 0) goto out_nolock; +#ifdef REMOVE_SUID_PATH + err = remove_suid(&file->f_path); +#else err = remove_suid(fdentry(file)); +#endif if (err) goto out_nolock; file_update_time(file); Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix do_sync_file_range ifdefs (2.6.22)Chris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Compile warning fixup in volume.cChris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Clone file data ioctlSage Weil2008-09-255-11/+179
| | | | | | Add a new ioctl to clone file data Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fixes for 2.6.18 enterprise kernelsChris Mason2008-09-253-7/+26
| | | | | | | | | | | | | | | 2.6.18 seems to get caught in an infinite loop when cancel_rearming_delayed_workqueue is called more than once, so this switches to cancel_delayed_work, which is arguably more correct. Also, balance_dirty_pages can run into problems with 2.6.18 based kernels because it doesn't have the per-bdi dirty limits. This avoids calling balance_dirty_pages on the btree inode unless there is actually something to balance, which is a good optimization in general. Finally there's a compile fix for ordered-data.h Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Tune stripe selection for raid1 and raid10Chris Mason2008-09-251-10/+7
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Deal with failed writes in mirrored configurationsChris Mason2008-09-254-8/+33
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Drop some verbose printksChris Mason2008-09-253-23/+10
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add balance ioctl to restripe the chunksChris Mason2008-09-255-27/+208
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add new ioctl to add devicesChris Mason2008-09-256-0/+108
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Do more optimal file RA during shrinking and defragChris Mason2008-09-252-9/+22
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Avoid recursive chunk allocationsChris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Make the resizer work based on shrinking and growing devicesChris Mason2008-09-256-108/+407
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: write_cache_pages came in 2.6.22Chris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add failure handling for read_sys_arrayChris Mason2008-09-252-9/+18
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: write_extent_pages came in 2.6.23Chris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Throttle file_write when data=ordered is flushing the inodeChris Mason2008-09-256-2/+28
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix balance_level to free the middle block if there is room in the ↵Chris Mason2008-09-252-9/+30
| | | | | | | | | | left one balance level starts by trying to empty the middle block, and then pushes from the right to the middle. This might empty the right block and leave a small number of pointers in the middle. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Don't empty the middle buffer in push_nodes_for_insertChris Mason2008-09-251-7/+12
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix split_node to require more empty slots in the node as wellChris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Make sure nodes have enough room for a double splitChris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix the unplug_io_fn to grab a consistent copy of page->mappingChris Mason2008-09-252-7/+22
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fix btrfs_get_extent and get_block corner cases, and disable O_DIRECT readsChris Mason2008-09-253-12/+23
| | | | | | | The generic O_DIRECT code assumes all the bios have the same bdev, which isn't true for multi-device btrfs. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Set nodatasum on the inode when written by a nodatasum mountChris Mason2008-09-251-0/+8
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Deal with page == NULL in the btrfs_unplug_io_fnChris Mason2008-09-251-2/+30
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add a special device list for chunk allocationsChris Mason2008-09-252-5/+17
| | | | | | | This allows other code that needs to walk every device in the FS to do so without locking against allocations. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Simplify device selection for mirrored readsChris Mason2008-09-252-20/+11
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Make an unplug function that doesn't unplug every spindleChris Mason2008-09-254-38/+75
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Remove debugging statements from the invalidatepage callsChris Mason2008-09-252-2/+3
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add 1MB to the min_free in alloc_chunkChris Mason2008-09-251-0/+3
| | | | | | This properly reflects the first 1MB we skip at the start of the device Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Scale the bdi ra_pages by the number of devices in the FSChris Mason2008-09-251-1/+3
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Force page->private removal in btrfs_invalidatepageChris Mason2008-09-252-0/+18
| | | | | | | | | | | | | 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>
* Btrfs: Set the btree inode i_size to OFFSET_MAXChris Mason2008-09-251-7/+26
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix chunk allocation when some devices don't have enough room for stripesChris Mason2008-09-251-16/+29
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Calculate appropriate chunk sizes for both small and large filesystemsChris Mason2008-09-251-7/+61
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Don't drop extent_map cache during releasepage on the btree inodeChris Mason2008-09-253-20/+44
| | | | | | | 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>
* Btrfs: Add support for labels in the super blockChris Mason2008-09-252-8/+11
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Check device uuids along with devidsChris Mason2008-09-252-7/+28
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Remove bogus max_sector warnings from the extent_io codeChris Mason2008-09-251-7/+0
| | | | | | | 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>
* Btrfs: Avoid 64 bit div for RAID10Chris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Use the extent map cache to find the logical disk block during data ↵Chris Mason2008-09-255-15/+168
| | | | | | | | | | | | | | | | | | | 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>
* Btrfs: Only do async bio submission for pdflushChris Mason2008-09-251-0/+7
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Don't wait on tree block writeback before freeing them anymoreChris Mason2008-09-253-6/+2
| | | | | | | 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>
* Btrfs: Write bio checksumming outside the FS mutexChris Mason2008-09-253-16/+45
| | | | | | | This significantly improves streaming write performance by allowing concurrency in the data checksumming. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Create a work queue for bio writesChris Mason2008-09-255-13/+119
| | | | | | | 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>
* Btrfs: Add RAID10 supportChris Mason2008-09-253-5/+49
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add chunk uuids and update multi-device back referencesChris Mason2008-09-257-62/+160
| | | | | | | | | | | | | | | | | | | | 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>