Revision 1: Stop ext3 reading the bh->b_private pointer on an in flight bh. Revision 2: 2.5 backport Revision 3: The locking when leaving __request was broken. Split off __deferring() Revision 4: s->table wasn't being set in the snapshot contructor Revision 5: I don't know why dm-ioctl.c was including rather than Revision 6: Four constants: DM_DIR, DM_MAX_TYPE_NAME, DM_NAME_LEN, DM_UUID_LEN Were being declared in device-mapper.h, these are all specific to the ioctl interface, so they've been moved to dm-ioctl.h. Nobody in userland should ever include so remove ifdef __KERNEL guards. Revision 7: No need to validate the parameters if we are doing a REMOVE_ALL command. Revision 8: Fluff Revision 9: Mempool version by Christoph Hellwig that holds the free objects in an array rather than a list. This prevents the objects getting dirtied, eg, people maybe expecting them to come out of a slab with a particular state. Revision 10: Return -ENOTBLK if lookup_device() finds the inode, but it is not a block device. [Cristoph Hellwig] Revision 11: get_kdev() was locking _minor_lock rather than &_minor_lock. [Heinz Mauelshagen] Revision 12: minor change for dm-strip.c. Tests for correct chunksize before it allocates the stripe context. [Heinz Mauelshagen] Revision 13: There's a bug in the dm-stripe.c constructor failing top check if enough destinations are handed in. [Heinz Mauelshagen] Revision 14: Give each device its own io mempool to avoid a potential deadlock with stacked devices. [HM + EJT] Revision 15: Let the persistent/non persistent arg to the snapshot constructor be case insensitive. [Heinz Mauelshagen] Revision 16: queue_io() was checking the DMF_SUSPENDED flag rather than the new DMF_BLOCK_IO flag. This meant suspend could deadlock under load. Revision 17: dm_suspend(): Stop holding the read lock around the while loop that waits for pending io to complete. Revision 18: Add a run_task_queue(&tq_disk) to encourage pending io to flush when we're doing a dm_suspend(). Revision 19: Don't hook the io until after the target->map function has been called. Revision 20: Lift the dm_io allocation out of __map_buffer so that it is outside of the read lock. Hook all io, not just simple mappings. Revision 21: Use a rw_semaphore in dm_target.c rather than a rwlock_t, just to keep in line with dm.c Revision 22: Don't let the ioctl interface drop a suspended device. Revision 23: Call dm_put_target_type() *after* calling the destructor. Revision 24: Fluff Revision 25: printk tgt->error if dm_table_add_target() fails. Revision 26: Just return an error from the error targets map function, rather than erroring the buffer_head. Revision 27: Export dm_table_get_mode() Revision 28: If an alloc_page() call fails in init_pages(), unlock all locked pages before freeing them. [Kevin Corry] Revision 29: The calls to calc_block_sizes() in kcopyd_write_pages() and kcopyd_copy() are redundant, since kcopyd_io() already calls calc_block_sizes(). Revision 30: Remove the line in dispatch_bh() that sets bh->b_dev to B_FREE, since it sets bh->b_dev to job->disk.dev a few lines later. [Kevin Corry] Revision 31: Move a set_bit() into the preceeding assignment statement. [Kevin Corry] Revision 32: Set bh->b_count to 1 in dispatch_bh(). [Kevin Corry] Revision 33: Comment fix in run_pages_job(). [Kevin Corry] Revision 34: In copy_write(), don't need to set job->context = info, since it is already set to that when the function is called. [Kevin Corry] Revision 35: Always halt a copy if the read part failed, not just when there is a notify_fn (fix coding error). [Kevin Corry] Revision 36: 'Persistent' flag checking in the snapshot target constructor had a coding error which meant that it was always invalid. Revision 37: Introduce an end_io method to the target types. Revision 38: Allow the map method to pass some context to the endio method. Revision 39: When reloading a device the ioctl interface was forgetting to drop a reference on the new table. Revision 40: alloc_io() cannot fail, so stop checking the return value. Revision 41: Fix problem with devfs when unloading the dm module. dm-ioctl.c: deregister the misc device, and its associated symlink *before* removing the /dev/mapper dir. [Alasdair Kergon] Revision 42: Hook the io before we call the targets map function, this allows us to implement little things like the zero target. Revision 43: Silly mistake in error path when an unknown target type is requested. Revision 44: Define SECTOR_SHIFT and SECTOR_SIZE in dm.h so each individual DM source file doesn't have to define them. Revision 45: When generating STATUSTYPE_TABLE strings, use bdevname() instead of kdevname() so the device-name will match the ones generated in the 2.5 kernels. This should keep the user-space tools simpler, since they will only have to parse one form of the device-name strings. [Kevin Corry] Revision 46: Allow slashes ('/') within a DM device name, but not at the beginning. Devfs will automatically create all necessary sub-directories if a name with embedded slashes is registered. [Kevin Corry] Revision 47: When initializing the ioctl interface, always print the info message, instead of only when devfs is not present. [Kevin Corry] Revision 48: When running on ppc64, sparc64, or x86-64, register ioctls with the ioctl32 translation layer. [Don Mulvey] Revision 49: In snapshot_ctr(), if the call to register_snapshot() fails, we need to unlock the origin's filesystem (if the VFS-lock patch has been applied). [Kevin Corry] Revision 50: In persistent_prepare(), when incrementing the next_free field and checking for the location for the next metadata area, it doesn't seem to account for the header chunk at the beginning of the cow device. For example: chunk_size = 32 (16k) exceptions_per_area = 1024 stride = 1025 The header is chunk 0, the first metadata area is chunk 1, and the first data area is chunks 2 through 1025. When next_free equals 1024 (the second- to-last data chunk in the first area), it will be incremented to 1025, then mod'd with stride to get 0, and then incremented again to 1026. This effectively skips the last data chunk in the first data area and sets next_free to the chunk for the second metadata area. I'm guessing this will eventually look like data corruption if the snapshot tries to read data from that chunk, since it will eventually be overwritten by metadata. This patch corrects this by checking for a mod value of 1, instead of 0. Another possible solution would be to change the prefix-increment to a postfix-increment. [Kevin Corry] Revision 51: Revert patches 44, 45 and 47 - will be re-integrated later. [Alasdair Kergon] Revision 52: Support for more architectures (parisc, mips64, ppc64, s390x, sparc64, x86_64) [Alasdair Kergon] Revision 53: In persistent_prepare(), the "enough-room-left" check only verifies that the start of the next-free chunk is within the cow device. If the cow device is not an even multiple of the chunk-size, the snapshot code will eventually try to write off the end of the cow device. Check that the entire next-free chunk is within the cow device. [Kevin Corry] Revision 54: In dm_create_persistent(), when setting up an existing snapshot, if the valid bit from the snapshot header is not set, refuse to activate the snapshot. [Kevin Corry] Revision 55: In __map_buffer(), the call to dm_table_find_target() will never return a NULL pointer (provided every DM device table has a valid "targets" array, which should be the case). It may, however, return a pointer to a blank target record (since there are always a KEYS_PER_NODE-multiple of target records in the B-tree, but not all of these target records are necessarily used). This will occur when DM receives an I/O request past the end of a device. (You'd think this shouldn't happen, but it does - generic_make_request() will allow an I/O one sector past the end of a device with an even number of sectors.) Instead of checking for a NULL return from dm_table_find_target(), check for a valid "type" field in the returned target. [Kevin Corry] Revision 56: Whitespace tweaking. [Alasdair Kergon] Revision 57: Tidy some DMWARNs. [Alasdair Kergon] Revision 58: Update version number. [Alasdair Kergon]