summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Btrfs: Fix releasepage to properly keep dirty and writeback pagesChris Mason2008-09-252-1/+6
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Update the highest objectid in a root after log replay is doneChris Mason2008-09-252-1/+9
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Tree logging fixesChris Mason2008-09-257-24/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Pin down data blocks to prevent them from being reallocated like so: trans 1: allocate file extent trans 2: free file extent trans 3: free file extent during old snapshot deletion trans 3: allocate file extent to new file trans 3: fsync new file Before the tree logging code, this was legal because the fsync would commit the transation that did the final data extent free and the transaction that allocated the extent to the new file at the same time. With the tree logging code, the tree log subtransaction can commit before the transaction that freed the extent. If we crash, we're left with two different files using the extent. * Don't wait in start_transaction if log replay is going on. This avoids deadlocks from iput while we're cleaning up link counts in the replay code. * Don't deadlock in replay_one_name by trying to read an inode off the disk while holding paths for the directory * Hold the buffer lock while we mark a buffer as written. This closes a race where someone is changing a buffer while we write it. They are supposed to mark it dirty again after they change it, but this violates the cow rules. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: properly set blocksize when adding new device.Zheng Yan2008-09-251-0/+2
| | | | | | --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Update find free objectid function for orphan cleanup codeZheng Yan2008-09-252-8/+10
| | | | | | | | | | Orphan items use BTRFS_ORPHAN_OBJECTID (-5UUL) as key objectid. This affects the find free objectid functions, inode objectid can easily overflow after orphan file cleanup. --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: trivial sparse fixesChristoph Hellwig2008-09-254-11/+7
| | | | | | | Fix a bunch of trivial sparse complaints. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* remove unused function btrfs_ilookupChristoph Hellwig2008-09-252-15/+0
| | | | | | | | btrfs_ilookup is unused, which is good because a normal filesystem should never have to use ilookup anyway. Remove it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: missing endianess conversion in insert_new_rootChristoph Hellwig2008-09-251-4/+5
| | | | | | | Add two missing endianess conversions in this function, found by sparse. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: cleanup d_obtain_alias useageChristoph Hellwig2008-09-251-15/+2
| | | | | | | | | d_obtain_alias is intended as a tailcall that can pass in errors encoded in the inode pointer if needed, so use it that way instead of duplicating the error handling. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Rev the disk formatChris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add a write ahead tree log to optimize synchronous operationsChris Mason2008-09-2517-205/+3408
| | | | | | | | | | | File syncs and directory syncs are optimized by copying their items into a special (copy-on-write) log tree. There is one log tree per subvolume and the btrfs super block points to a tree of log tree roots. After a crash, items are copied out of the log tree and back into the subvolume. See tree-log.c for all the details. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Add debugging checks to track down corrupted metadataChris Mason2008-09-254-34/+49
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: optimize btrget/set/removexattrChristoph Hellwig2008-09-254-170/+104
| | | | | | | | | | | | btrfs actually stores the whole xattr name, including the prefix ondisk, so using the generic resolver that strips off the prefix is not very helpful. Instead do the real ondisk xattrs manually and only use the generic resolver for synthetic xattrs like ACLs. (Sorry Josef for guiding you towards the wrong direction here intially) Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs: optmize listxattrChristoph Hellwig2008-09-253-81/+11
| | | | | | | | | | | | | The ->list handler is really not useful at all, because we always call btrfs_xattr_generic_list anyway. After this is done find_btrfs_xattr_handler becomes unused, and it becomes obvious that the temporary name buffer allocation isn't needed but we can directly copy into the supplied buffer. Tested with various getfattr -d calls on varying xattr lists. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: compile when posix acl's are disabledJosef Bacik2008-09-252-2/+22
| | | | | | | This patch makes btrfs so it will compile properly when acls are disabled. I tested this and it worked with CONFIG_FS_POSIX_ACL off and on. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix variable init during csum creationChris Mason2008-09-251-0/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Throttle for async bio submits higher up the chainChris Mason2008-09-252-7/+7
| | | | | | | | | | | | | | | The current code waits for the count of async bio submits to get below a given threshold if it is too high right after adding the latest bio to the work queue. This isn't optimal because the caller may have sequential adjacent bios pending they are waiting to send down the pipe. This changeset requires the caller to wait on the async bio count, and changes the async checksumming submits to wait for async bios any time they self throttle. The end result is much higher sequential throughput. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Rev the disk formatChris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Clean up btrfs_get_parent() a little more, fix a free-after-free bugDavid Woodhouse2008-09-251-13/+18
| | | | | | Date: Tue, 19 Aug 2008 22:33:04 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix NFS exporting of subvol roots.David Woodhouse2008-09-251-1/+12
| | | | | | | | | | | | | Date: Tue, 19 Aug 2008 22:20:17 +0100 btrfs_lookup_fs_root() only finds subvol roots which have already been seen and put into the cache. For btrfs_get_dentry() we actually have to go to the medium -- so use btrfs_read_fs_root_no_name() instead. In btrfs_get_parent(), notice when we've hit the root of the subvolume and return the real root instead. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Switch btrfs_name_hash() to crc32cDavid Woodhouse2008-09-253-114/+7
| | | | | | | | | Date: Tue, 19 Aug 2008 19:21:57 +0100 Using a 64-bit hash as the readdir cookie is just asking for trouble. And gets it, when we try to export the file system by NFS. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Reinstate '-osubvol=.' option to mount entire treeDavid Woodhouse2008-09-251-15/+19
| | | | | | | | Date: Tue, 19 Aug 2008 16:49:35 +0100 This disappeared when I removed the special case for '.' in btrfs_lookup() Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Simplify btrfs_get_parent(), fix use-after-free bugDavid Woodhouse2008-09-251-15/+11
| | | | | | Date: Mon, 18 Aug 2008 22:50:22 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Mask root object ID into f_fsid in btrfs_statfs()David Woodhouse2008-09-251-0/+4
| | | | | | | | | Date: Mon, 18 Aug 2008 13:10:20 +0100 This means that subvolumes get a different fsid, and NFS exporting them works properly. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fill f_fsid field in btrfs_statfs()David Woodhouse2008-09-251-0/+6
| | | | | | Date: Mon, 18 Aug 2008 12:01:52 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Optimise NFS readdir hack slightly; don't call readdir() again when doneDavid Woodhouse2008-09-251-4/+7
| | | | | | Date: Sun, 17 Aug 2008 17:12:56 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Minor cleanup of btrfs_real_readdir()David Woodhouse2008-09-251-15/+21
| | | | | | Date: Sun, 17 Aug 2008 17:08:36 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Remove special cases for "." and ".."David Woodhouse2008-09-251-50/+2
| | | | | | | | | Date: Sun, 17 Aug 2008 15:14:48 +0100 We never get asked by the VFS to lookup either of them, and we can handle the readdir() case a lot more simply, too. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Discard sector data in __free_extent()David Woodhouse2008-09-251-0/+25
| | | | | | Date: Tue, 12 Aug 2008 14:13:26 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Implement our own copy of the nfsd readdir hack, for older kernelsDavid Woodhouse2008-09-251-2/+102
| | | | | | Date: Wed, 6 Aug 2008 19:42:33 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* NFS support for btrfs - v3Balaji Rao2008-09-255-1/+247
| | | | | | | | | | | | | | | | Date: Mon, 21 Jul 2008 02:01:56 +0530 Here's an implementation of NFS support for btrfs. It relies on the fixes which are going in to 2.6.28 for the NFS readdir/lookup deadlock. This uses the btrfs_iget helper introduced previously. [dwmw2: Tidy up a little, switch to d_obtain_alias() w/compat routine, change fh_type, store parent's root object ID where needed, fix some get_parent() and fs_to_dentry() bugs] Signed-off-by: Balaji Rao <balajirrao@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Introduce btrfs_iget helperBalaji Rao2008-09-252-18/+39
| | | | | | | | | Date: Mon, 21 Jul 2008 02:01:04 +0530 This patch introduces a btrfs_iget helper to be used in NFS support. Signed-off-by: Balaji Rao <balajirrao@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Wait for async bio submissions to make some progress at queue timeChris Mason2008-09-254-10/+27
| | | | | | | | Before, the btrfs bdi congestion function was used to test for too many async bios. This keeps that check to throttle pdflush, but also adds a check while queuing bios. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Lookup readpage checksums on bio submission againChris Mason2008-09-252-60/+6
| | | | | | | | This optimization had been removed because I thought it was triggering csum errors. The real cause of the errors was elsewhere, and so this optimization is back. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix add_extent_mapping to check for duplicates across the whole rangeChris Mason2008-09-252-4/+24
| | | | | | | | | | | | add_extent_mapping was allowing the insertion of overlapping extents. This never used to happen because it only inserted the extents from disk and those were never overlapping. But, with the data=ordered code, the disk and memory representations of the file are not the same. add_extent_mapping needs to ensure a new extent does not overlap before it inserts. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Remove broken optimisations in end_bio functions.David Woodhouse2008-09-251-138/+21
| | | | | | | | | These ended up freeing objects while they were still using them. Under guidance from Chris, just rip out the 'clever' bits and do things the simple way. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Lower contention on the csum mutexChris Mason2008-09-254-8/+22
| | | | | | | This takes the csum mutex deeper in the call chain and releases it more often. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Wait for kernel threads to make progress during async submissionChris Mason2008-09-253-20/+33
| | | | | | | | | | | Before this change, btrfs would use a bdi congestion function to make sure there weren't too many pending async checksum work items. This change makes the process creating async work items wait instead, leading to fewer congestion returns from the bdi. This improves pdflush background_writeout scanning. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Give all the worker threads descriptive namesChris Mason2008-09-253-10/+24
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Transaction commit: don't use filemap_fdatawaitChris Mason2008-09-253-12/+36
| | | | | | | | | | | | After writing out all the remaining btree blocks in the transaction, the commit code would use filemap_fdatawait to make sure it was all on disk. This means it would wait for blocks written by other procs as well. The new code walks the list of blocks for this transaction again and waits only for those required by this transaction. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Count async bios separately from async checksum work itemsChris Mason2008-09-253-6/+26
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Limit the number of async bio submission kthreads to the number of ↵Chris Mason2008-09-251-1/+3
| | | | | | devices Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Init address_space->writeback_index properlyChris Mason2008-09-251-0/+4
| | | | | | | | | | | The writeback_index field is used by write_cache_pages to pick up where writeback on a given inode left off. But, it is never set to a sane value, so writeback can often start at a random offset in the file. Kernels 2.6.28 and higher will have this fixed, but for everyone else, we also fill in the value in btrfs. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Change TestSetPageLocked() to trylock_page()David Woodhouse2008-09-252-1/+5
| | | | | | | | | | | | Add backwards compatibility in compat.h Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> --- compat.h | 3 +++ extent_io.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: fix RHEL test for ClearPageFsMiscEric Sandeen2008-09-251-1/+1
| | | | | | | | | | Newer RHEL5 kernels define both ClearPageFSMisc and ClearPageChecked, so test for both before redefining. Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Update version.sh to v0.16Chris Mason2008-09-251-1/+1
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Avoid calling into the FS for the final iput on fake root inodesChris Mason2008-09-252-0/+4
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix nodatacow for the new data=ordered modeYan Zheng2008-09-257-34/+74
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Get rid of BTRFS_I(inode)->index and use local vars insteadChris Mason2008-09-252-34/+34
| | | | | | | | rename and link don't always have a lock on the source inode, and our use of a per-inode index variable was racy. This changes things to store the index in a local variable instead. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: Fix the multi-bio code to save the original bio for completionChris Mason2008-09-252-1/+11
| | | | | | | | | | | | | | | | The multi-bio code is responsible for duplicating blocks in raid1 and single spindle duplication. It has counters to make sure all of the locations for a given extent are properly written before io completion is returned to the higher layers. But, it didn't always complete the same bio it was given, sometimes a clone was completed instead. This lead to problems with the async work queues because they saved a pointer to the bio in a struct off bi_private. The fix is to remember the original bio and only complete that one. Signed-off-by: Chris Mason <chris.mason@oracle.com>
OpenPOWER on IntegriCloud