summaryrefslogtreecommitdiff
path: root/fs/btrfs/volumes.h
AgeCommit message (Collapse)AuthorFilesLines
2009-06-10Btrfs: avoid races between super writeout and device list updatesChris Mason1-1/+6
On multi-device filesystems, btrfs writes supers to all of the devices before considering a sync complete. There wasn't any additional locking between super writeout and the device list management code because device management was done inside a transaction and super writeout only happened with no transation writers running. With the btrfs fsync log and other async transaction updates, this has been racey for some time. This adds a mutex to protect the device list. The existing volume mutex could not be reused due to transaction lock ordering requirements. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-10Btrfs: autodetect SSD devicesChris Mason1-0/+5
During mount, btrfs will check the queue nonrot flag for all the devices found in the FS. If they are all non-rotating, SSD mode is enabled by default. If the FS was mounted with -o nossd, the non-rotating flag is ignored. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-04-27Btrfs: When shrinking, only update disk size on successChris Ball1-0/+3
Previously, we updated a device's size prior to attempting a shrink operation. This patch moves the device resizing logic to only happen if the shrink completes successfully. In the process, it introduces a new field to btrfs_device -- disk_total_bytes -- to track the on-disk size. Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-04-20Btrfs: use WRITE_SYNC for synchronous writesChris Mason1-2/+11
Part of reducing fsync/O_SYNC/O_DIRECT latencies is using WRITE_SYNC for writes we plan on waiting on in the near future. This patch mirrors recent changes in other filesystems and the generic code to use WRITE_SYNC when WB_SYNC_ALL is passed and to use WRITE_SYNC for other latency critical writes. Btrfs uses async worker threads for checksumming before the write is done, and then again to actually submit the bios. The bio submission code just runs a per-device list of bios that need to be sent down the pipe. This list is split into low priority and high priority lists so the WRITE_SYNC IO happens first. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-04-03Btrfs: fix typos in commentsWu Fengguang1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-12-12Btrfs: shared seed deviceYan Zheng1-2/+1
This patch makes seed device possible to be shared by multiple mounted file systems. The sharing is achieved by cloning seed device's btrfs_fs_devices structure. Thanks you, Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-12-09Btrfs: superblock duplicationYan Zheng1-2/+4
This patch implements superblock duplication. Superblocks are stored at offset 16K, 64M and 256G on every devices. Spaces used by superblocks are preserved by the allocator, which uses a reverse mapping function to find the logical addresses that correspond to superblocks. Thank you, Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-12-02Btrfs: corret fmode_t annotationsChristoph Hellwig1-2/+2
Make sure to propagate fmode_t properly and use the right constants for it. Signed-off-by: Christoph Hellwig <hch@lst.de>
2008-11-20Btrfs: Fixes for 2.6.28-rc API changesChris Mason1-0/+3
* open/close_bdev_excl -> open/close_bdev_exclusive * blkdev_issue_discard takes a GFP mask now * Fix blkdev_issue_discard usage now that it is enabled Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-11-18Btrfs: Seed device supportYan Zheng1-6/+14
Seed device is a special btrfs with SEEDING super flag set and can only be mounted in read-only mode. Seed devices allow people to create new btrfs on top of it. The new FS contains the same contents as the seed device, but it can be mounted in read-write mode. This patch does the following: 1) split code in btrfs_alloc_chunk into two parts. The first part does makes the newly allocated chunk usable, but does not do any operation that modifies the chunk tree. The second part does the the chunk tree modifications. This division is for the bootstrap step of adding storage to the seed device. 2) Update device management code to handle seed device. The basic idea is: For an FS grown from seed devices, its seed devices are put into a list. Seed devices are opened on demand at mounting time. If any seed device is missing or has been changed, btrfs kernel module will refuse to mount the FS. 3) make btrfs_find_block_group not return NULL when all block groups are read-only. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-09-25Btrfs: Fix the multi-bio code to save the original bio for completionChris Mason1-0/+1
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>
2008-09-25Btrfs: Add async worker threads for pre and post IO checksummingChris Mason1-3/+7
Btrfs has been using workqueues to spread the checksumming load across other CPUs in the system. But, workqueues only schedule work on the same CPU that queued the work, giving them a limited benefit for systems with higher CPU counts. This code adds a generic facility to schedule work with pools of kthreads, and changes the bio submission code to queue bios up. The queueing is important to make sure large numbers of procs on the system don't turn streaming workloads into random workloads by sending IO down concurrently. The end result of all of this is much higher performance (and CPU usage) when doing checksumming on large machines. Two worker pools are created, one for writes and one for endio processing. The two could deadlock if we tried to service both from a single pool. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Fix btrfs_open_devices to deal with changes since the scan ioctlsChris Mason1-2/+2
Devices can change after the scan ioctls are done, and btrfs_open_devices needs to be able to verify them as they are opened and used by the FS. Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add mount -o degraded to allow mounts to continue with missing devicesChris Mason1-0/+3
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add support for online device removalChris Mason1-0/+3
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>
2008-09-25Btrfs: Deal with failed writes in mirrored configurationsChris Mason1-1/+2
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add balance ioctl to restripe the chunksChris Mason1-0/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add new ioctl to add devicesChris Mason1-0/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Make the resizer work based on shrinking and growing devicesChris Mason1-0/+5
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add a special device list for chunk allocationsChris Mason1-0/+7
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>
2008-09-25Btrfs: Make an unplug function that doesn't unplug every spindleChris Mason1-0/+2
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add chunk uuids and update multi-device back referencesChris Mason1-2/+4
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>
2008-09-25Btrfs: Write out all super blocks on commit, and bring back proper barrier ↵Chris Mason1-0/+3
support Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Retry metadata reads in the face of checksum failuresChris Mason1-2/+4
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Change btrfs_map_block to return a structure with mappings for all stripesChris Mason1-3/+22
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add support for mirroring across drivesChris Mason1-5/+6
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add support for device scanning and detection ioctlsChris Mason1-0/+25
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Bring back mount -o ssd optimizationsChris Mason1-0/+3
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Move device information into the super block so it can be scannedChris Mason1-12/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Dynamic chunk and block group allocationChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25Btrfs: Add support for multiple devices per filesystemChris Mason1-0/+78
Signed-off-by: Chris Mason <chris.mason@oracle.com>