Commit Graph

1891 Commits

Author SHA1 Message Date
Brian Behlendorf 45a5551a0e Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch
Conflicts:

	module/zfs/zfs_ioctl.c
2009-11-20 12:11:23 -08:00
Brian Behlendorf fb1b00e9f4 Linux ZVOL implementation; kernel-side changes
At last a useful user space interface for the Linux ZFS port arrives.
With the addition of the ZVOL real ZFS based block devices are available
and can be compared head to head with Linux's MD and LVM block drivers.
The Linux ZVOL has not yet had any performance work done but from a user
perspective it should be functionally complete and behave like any other
Linux block device.

The ZVOL has so far been tested using zconfig.sh on the following x86_64
based platforms: FC11, CHAOS4, RHEL5, RHEL6, and SLES11.  However, more
testing is required to ensure everything is working as designed.

What follows in a somewhat detailed list of changes includes in this
commit to make ZVOL's possible.  A few other issues were addressed in
the context of these changes which will also be mentioned.

* Added module/zfs/zvol.c which is based off the original Solaris ZVOL
implementation but rewritten to intergrate with the Linux block device
APIs.  The basic design remains the similar in Linux with the major
change being request processing.  Request processing is handled by
registering a request function which the elevator calls once all request
merges is finished and the elevator unplugs.  This function is called
under a spin lock and the request structure is passed to the block driver
to be queued for IO.  The elevator must be notified asyncronously once
the request completes or fails with an error.  This allows us the block
driver a chance to handle many request concurrently.  For the ZVOL we
maintain a taskq with a service thread per core.  As requests are delivered
by the elevator each request is dispatched to the taskq.  The task queue
handles each request with a write or read helper function which basically
copies the request data in to our out of the DMU object.  Writes single
completion as soon as the DMU has the data unless they are marked sync.
Reads are all handled syncronously however the elevator will merge many
small reads in to a large read before it submitting the request.

* Cachine is worth specifically mentioning.  Because both the Linux VFS
and the ZFS ARC both want to fully manage the cache we unfortunately
end up with two caches.  This means our memory foot print is larger
than otherwise expected, and it means we have an extra copy between
the caches, but it does not impact correctness.  All syncs are barrior
requests I believe are handled correctly.  Longer term there is lots of
room for improvement here but it will require fairly extensive changes
to either the Linux VFS and VM layer, or additional DMU interfaces to
handle managing buffer not directly allocated by the ARC.

* Added module/zfs/include/sys/blkdev.h which contains all the Linux
compatibility foo which is required to handle changes in the Linux block
APIs from 2.6.18 thru 2.6.31 based kernels.

* The dmu_{read,write}_uio interfaces which don't make sense on Linux
have been modified to dmu_{read,write}_req functions which consume the
standard Linux IO request structure.  Their function fundamentally
remains the same so this happily worked out pretty cleanly.

* The /dev/zfs character device is no longer created through the half
implemented Solaris driver DDI interfaces.  It is now simply created
with it's own major number as a Linux misc device which greatly simplifies
everything.  It is only capable of handling ioctls() but this fits nicely
because that's all it ever has to do.  The ZVOL devices unlike in Solaris
do not leverage the same major number as /dev/zfs but instead register
their own major.  Because only one major is allocated and space is reserved
for 16 partitions per-device there is a limit of 16384 concurrent ZVOL
devices.  By using multiple majors like the scsi driver this limit could
be addressed if it becomes a problem.

* The {spa,zfs,zvol}_busy() functions have all be removed because they
are not required on a Linux system.  Under Linux the registered module
exit function will not be called while the are still references to the
module.  Once the exit function is called however it must succeed or
block, it may not fail so returning an error on module unload makes to
sense under Linux.

* With the addition of ZVOL support all the HAVE_ZVOL defines were removed
for obvious reasons.  However, the HAVE_ZPL defines have been relocated
in to the linux-{kernel,user}-disk topic branches and must remain until
the ZPL is implemented.
2009-11-20 11:06:59 -08:00
Brian Behlendorf 6376951ac9 Merge branch 'linux-have-sysevent' into refs/top-bases/linux-zfs-branch 2009-11-20 10:58:52 -08:00
Brian Behlendorf 67154a81b9 Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent 2009-11-20 10:58:51 -08:00
Brian Behlendorf bc20ccb15c Revert just zfs_ioctl.c changes moved to linux-kernel-disk branch. 2009-11-20 10:55:19 -08:00
Brian Behlendorf a40a4803a8 Merge branch 'linux-have-uio-rw' into refs/top-bases/linux-zfs-branch 2009-11-20 10:39:42 -08:00
Brian Behlendorf 6936334ac1 Revert linux-have-uio-rw branch, moved to linux-kernel-disk branch. 2009-11-20 10:35:26 -08:00
Brian Behlendorf 49fdb13bc8 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2009-11-20 10:30:50 -08:00
Brian Behlendorf 29dd6c3161 Merge commit 'refs/top-bases/linux-have-uio-rw' into linux-have-uio-rw 2009-11-20 10:30:42 -08:00
Brian Behlendorf 7da32c3c8e Merge commit 'refs/top-bases/linux-debug-zerocopy' into linux-debug-zerocopy 2009-11-20 10:30:41 -08:00
Brian Behlendorf 4edabd1904 Merge branch 'linux-have-sysevent' into refs/top-bases/linux-zfs-branch 2009-11-20 10:30:30 -08:00
Brian Behlendorf d40808c351 Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent 2009-11-20 10:30:28 -08:00
Brian Behlendorf 07cdadc1f8 Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2009-11-20 10:30:27 -08:00
Brian Behlendorf 6d8a17ed45 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2009-11-20 10:29:52 -08:00
Brian Behlendorf cac1bc41dc Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2009-11-20 10:29:49 -08:00
Brian Behlendorf 77c347db31 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2009-11-20 10:29:48 -08:00
Brian Behlendorf 0f315a58bb Merge branch 'gcc-uninit' into refs/top-bases/gcc-branch 2009-11-20 10:29:47 -08:00
Brian Behlendorf 0160d32326 Symbol spa_busy() not required in Linux port removing EXPORT_SYMBOL 2009-11-20 10:16:37 -08:00
Brian Behlendorf 3191b962f6 Prevent gcc uninit compiler warning in zfs_range_unlock_reader(). 2009-11-20 09:59:58 -08:00
Brian Behlendorf 50e6c144e6 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2009-11-15 16:28:08 -08:00
Brian Behlendorf 52f859a6cc Merge commit 'refs/top-bases/linux-have-uio-rw' into linux-have-uio-rw 2009-11-15 16:27:59 -08:00
Brian Behlendorf af5810b03a Merge commit 'refs/top-bases/linux-debug-zerocopy' into linux-debug-zerocopy 2009-11-15 16:27:59 -08:00
Brian Behlendorf c03a7d863c Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent 2009-11-15 16:27:44 -08:00
Brian Behlendorf b6c57fe77e Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2009-11-15 16:27:44 -08:00
Brian Behlendorf 1b5b05c1c3 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2009-11-15 16:27:05 -08:00
Brian Behlendorf d00a0ea8a0 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2009-11-15 16:27:02 -08:00
Brian Behlendorf 59cbe87375 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2009-11-15 16:26:31 -08:00
Brian Behlendorf 217998d1a3 Merge commit 'refs/top-bases/gcc-uninit' into gcc-uninit 2009-11-15 16:26:12 -08:00
Brian Behlendorf d8aef5d7bc Merge branch 'gcc-c90' into refs/top-bases/gcc-branch 2009-11-15 16:25:52 -08:00
Brian Behlendorf 030d49c262 Merge commit 'refs/top-bases/gcc-c90' into gcc-c90 2009-11-15 16:25:50 -08:00
Brian Behlendorf 0aa61e8427 Remove zvol.c when updating in update-zfs.sh Linux version available. 2009-11-15 16:20:01 -08:00
Brian Behlendorf e576375b9f Merge branch 'linux-have-zpl' into refs/top-bases/linux-zfs-branch 2009-11-15 16:11:05 -08:00
Brian Behlendorf e588ef08cb Revert contents of linux-have-zpl topic branch. 2009-11-15 16:06:10 -08:00
Brian Behlendorf d876a087ff Merge branch 'linux-have-zvol' into refs/top-bases/linux-zfs-branch 2009-11-15 15:58:22 -08:00
Brian Behlendorf b38252d3ec Revert contents of linux-have-zvol topic branch. 2009-11-15 15:52:29 -08:00
Brian Behlendorf a4fb9a97f1 Merge branch 'linux-kernel-mem' into refs/top-bases/linux-zfs-branch 2009-11-12 12:55:54 -08:00
Brian Behlendorf e68f100aaa Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch 2009-11-12 12:55:49 -08:00
Brian Behlendorf 73fe782522 Use HAVE_BDEV_LOGICAL_BLOCK_SIZE compat marco in vdev_disk.
This is a 2.6.31 API change.
2009-11-12 12:51:16 -08:00
Brian Behlendorf 564d6273e2 Mutexs will exceed 64 bytes for debug builds in 2.6.31 kernels.
Increase the pad size accordingly to handle this.
2009-11-12 12:45:28 -08:00
Brian Behlendorf 6f111fc3e6 Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch 2009-10-27 15:03:16 -07:00
Brian Behlendorf ed97b4447d Adds the last missing block device support (merge_bdev support)
This change should wrap up the last of the missing block device
support in the vdev_disk layer.  With this change I can now
successfully create and use zpools which are layered on top of
md and lvm virtual devices.  The following changes include:

1) The big one, properly handle the case when page cannot be added
to a bio due to dynamic limitation of a merge_bdev handler.  For
example the md device will limit a bio to the configured stripe
size.  Our bio size may also end up being limited by the maximum
request size, and other factors determined during bio construction.

To handle all of the above cases the code has been updated to
handle failures from bio_add_page().  This had been hardcoded to
never fail for the prototype proof of concept implementation.  In
the case of a failure the number of bytes which still need to be
added to a bio are returned.  New bio's are allocated and attached
to the dio until the entire data buffer is mapped to bios.  It is
then submitted as before to the request queue, and once all the bio's
attached to a dio have finished the completion callback is run.

2) The devid comments have been removed because it is not clear to
me that we will not need devid support.  They have been replaced
with a comment explaining that udev can and should be used.
2009-10-27 14:38:38 -07:00
Brian Behlendorf ef2618aff8 Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch 2009-10-14 16:32:15 -07:00
Brian Behlendorf 18eee5d03f Fix sector size and capacity calculation.
Remove the hard coded 512 byte SECTOR_SIZE and replace it with
bdev_hardsect_size() to get the correct hardware sector size.

Usage of get_capacity() was incorrect.  We the block_device
references a partition we need to return bdev->part->nr_sects.
If get_capacity() is used the entire device size will be returned
ignoring partition information.  This is however the correct thing
to do when the block device in question has not partition table.
2009-10-14 16:02:51 -07:00
Brian Behlendorf 5b421bb734 Merge commit 'refs/top-bases/linux-have-uio-rw' into linux-have-uio-rw 2009-10-06 12:27:51 -07:00
Brian Behlendorf 6df0b54851 Merge commit 'refs/top-bases/linux-debug-zerocopy' into linux-debug-zerocopy 2009-10-06 12:27:50 -07:00
Brian Behlendorf bea5b8a0a2 Merge branch 'linux-have-sysevent' into refs/top-bases/linux-zfs-branch 2009-10-06 12:27:31 -07:00
Brian Behlendorf cf1bc6baa5 Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent 2009-10-06 12:27:28 -07:00
Brian Behlendorf 5bc2e9e592 Add spa_config_path module option for alternate cache file. 2009-10-06 12:17:38 -07:00
Brian Behlendorf 73ff39b18d Merge branch 'linux-zpios' into refs/top-bases/linux-zfs-branch 2009-10-02 16:35:40 -07:00
Brian Behlendorf b5b5b23cbf Use kobject_set_name() for increased portability.
As of 2.6.25 kobj->k_name was replaced with kobj->name.  Some distros
such as RHEL5 (2.6.18) add a patch to prevent this from being a problem
but other older distros such as SLES10 (2.6.16) have not.  To avoid
the whole issue I'm updating the code to use kobject_set_name() which
does what I want and has existed all the way back to 2.6.11.
2009-10-02 16:31:23 -07:00