Commit Graph

109 Commits

Author SHA1 Message Date
Brian Behlendorf acf6f07ace Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch 2010-08-09 16:51:26 -07:00
Brian Behlendorf dd11e3f7f0 Limit sysfs name to KOBJ_NAME_LEN
See commit dfc166d174 for details.
2010-08-09 16:45:38 -07:00
Brian Behlendorf 5ce3b77ef8 Remove /zvol/ path component for zvol devices
As part of commit f162433deb the /zvol/
path component was added for zvol devices.  This ensured all zvol
devices would be created by udev in /dev/zvol/<pool>/<dataset>, as
opposed to the previous /dev/<pool>/<dataset> path.  Logically, it
was nice to organize them in a directory much like Solaris does.

However, while initial testing showed this to work fine with modern
kernels it does not appear to be supported under RHEL5.  The extra
path component triggers a NULL deref in create_dir().  Anyway, to
avoid having different zvol path names based on your kernel version
its more consistent simply to revert to the original naming convention.
If you really want the zvol component you can always add custom
udev rules to do exactly this.

We can revisiting this change again once we are willing to drop
support for RHEL5 and similar older distros.
2010-08-09 16:42:42 -07:00
Brian Behlendorf f58729aa42 Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch 2010-08-02 12:54:55 -07:00
Brian Behlendorf f162433deb Minor device creation/removal (Kernel)
With the update to onnv_141 how minor devices were created and
removed for ZVOL was substantially changed.  The updated system
is much more tightly integrated with Solaris's /dev/ filesystem.
This is great for Solaris but bad for Linux.

On the kernel side the ZFS_IOC_{CREATE,REMOVE}_MINOR ioctl
entry points have been re-added.  They now call directly in
to the ZVOL to create the needed minor node and add the sysfs
entried for udev.

Also as part of this change I've decided it would really be
best if all the zvols were in a /dev/zvol directory like on
Solaris.  Organizationally this makes sense and on the code
side it allows us to know a block device is a zvol simply by
where it is located in /dev/.  Unless Solaris there still is
to ./dsk or ./rdsk as part of the path.
2010-08-02 11:49:08 -07:00
Brian Behlendorf 3731ec7cf5 Merge branch 'linux-debug-zerocopy' into refs/top-bases/linux-zfs-branch 2010-06-14 16:11:05 -07:00
Brian Behlendorf e92d6d861f Update linux-kernel-module with refreshed EXPORT_SYMBOLs
After such a large update many of the symbols which were previously
exported are no longer available, and several new symbols have been
added and are needed.  Refresh to topic branch to reflect this.
2010-06-14 15:58:15 -07:00
Brian Behlendorf 24d1a8e0ed Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2010-06-14 15:53:43 -07:00
Brian Behlendorf 2a00f10bf8 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-06-14 15:52:11 -07:00
Brian Behlendorf fb35fe3bc1 Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-06-14 15:51:56 -07:00
Brian Behlendorf c430e23552 Update zfs-branch with build system updates
Required Makefile modifications for updated ZFS code.
2010-06-14 15:46:11 -07:00
Brian Behlendorf fe4485488c Merge branch 'linux-kernel-disk' into refs/top-bases/linux-zfs-branch
Conflicts:
	module/zcommon/include/sys/fs/zfs.h
	module/zfs/include/sys/zfs_ioctl.h
2010-05-28 22:16:13 -07:00
Brian Behlendorf b41143632b Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch
Conflicts:
	cmd/zpool/zpool_main.c
	cmd/zpool/zpool_vdev.c
	cmd/ztest/ztest.c
	lib/libzfs/libzfs_dataset.c
	lib/libzfs/libzfs_import.c
	lib/libzfs/libzfs_mount.c
	lib/libzfs/libzfs_pool.c
	lib/libzfs/libzfs_sendrecv.c
	lib/libzpool/include/sys/zfs_context.h
	module/zcommon/include/sys/fs/zfs.h
	module/zcommon/zfs_comutil.c
	module/zfs/arc.c
	module/zfs/dmu.c
	module/zfs/dmu_objset.c
	module/zfs/dmu_send.c
	module/zfs/dmu_tx.c
	module/zfs/dsl_dataset.c
	module/zfs/dsl_dir.c
	module/zfs/dsl_scrub.c
	module/zfs/fm.c
	module/zfs/include/sys/dmu.h
	module/zfs/include/sys/fm/fs/zfs.h
	module/zfs/include/sys/fm/protocol.h
	module/zfs/include/sys/spa.h
	module/zfs/include/sys/zfs_context.h
	module/zfs/include/sys/zfs_ioctl.h
	module/zfs/include/sys/zvol.h
	module/zfs/spa.c
	module/zfs/spa_boot.c
	module/zfs/spa_history.c
	module/zfs/spa_misc.c
	module/zfs/txg.c
	module/zfs/vdev.c
	module/zfs/zfs_fm.c
	module/zfs/zfs_ioctl.c
	module/zfs/zfs_replay.c
	module/zfs/zfs_znode.c
	module/zfs/zil.c
	module/zfs/zio.c
2010-05-28 22:14:39 -07:00
Brian Behlendorf a6c16054e5 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk
Conflicts:
	module/zcommon/include/sys/fs/zfs.h
	module/zfs/dmu.c
	module/zfs/dsl_dataset.c
	module/zfs/include/sys/dmu.h
	module/zfs/include/sys/spa.h
	module/zfs/include/sys/zfs_ioctl.h
	module/zfs/include/sys/zvol.h
	module/zfs/zfs_replay.c
	module/zfs/zfs_znode.c
2010-05-28 21:26:02 -07:00
Brian Behlendorf 97c49607ec Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module
Conflicts:
	module/zcommon/zfs_comutil.c
	module/zfs/arc.c
	module/zfs/dmu_objset.c
	module/zfs/dmu_tx.c
	module/zfs/dsl_dataset.c
	module/zfs/dsl_dir.c
	module/zfs/spa.c
	module/zfs/spa_boot.c
	module/zfs/spa_misc.c
	module/zfs/vdev.c
	module/zfs/zil.c
	module/zfs/zio.c
2010-05-28 16:01:35 -07:00
Brian Behlendorf 812761eac5 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch
Conflicts:
	cmd/ztest/ztest.c
2010-05-28 15:46:10 -07:00
Brian Behlendorf 3e2be634a5 Merge branch 'gcc-c90' into refs/top-bases/gcc-branch
Conflicts:
	cmd/zdb/zdb.c
	cmd/zdb/zdb_il.c
	cmd/zfs/zfs_main.c
	cmd/zfs/zfs_util.h
	cmd/zinject/zinject.h
	cmd/zpool/zpool_main.c
	cmd/zpool/zpool_util.c
	cmd/ztest/ztest.c
	lib/libnvpair/include/libnvpair.h
	lib/libnvpair/libnvpair.c
	lib/libzfs/libzfs_changelist.c
	lib/libzfs/libzfs_config.c
	lib/libzfs/libzfs_dataset.c
	lib/libzfs/libzfs_import.c
	lib/libzfs/libzfs_mount.c
	lib/libzfs/libzfs_pool.c
	lib/libzfs/libzfs_sendrecv.c
	module/avl/avl.c
	module/avl/include/sys/avl.h
	module/nvpair/include/sys/nvpair.h
	module/nvpair/nvpair.c
	module/zcommon/include/zfs_comutil.h
	module/zcommon/include/zfs_prop.h
	module/zcommon/zfs_comutil.c
	module/zfs/arc.c
	module/zfs/dbuf.c
	module/zfs/dmu.c
	module/zfs/dmu_objset.c
	module/zfs/dmu_zfetch.c
	module/zfs/dnode_sync.c
	module/zfs/dsl_dataset.c
	module/zfs/dsl_pool.c
	module/zfs/dsl_prop.c
	module/zfs/dsl_synctask.c
	module/zfs/include/sys/dmu_tx.h
	module/zfs/include/sys/dmu_zfetch.h
	module/zfs/include/sys/dsl_synctask.h
	module/zfs/include/sys/refcount.h
	module/zfs/include/sys/txg.h
	module/zfs/include/sys/uberblock.h
	module/zfs/include/sys/zap_leaf.h
	module/zfs/include/sys/zfs_debug.h
	module/zfs/include/sys/zfs_znode.h
	module/zfs/include/sys/zio_compress.h
	module/zfs/include/sys/zvol.h
	module/zfs/lzjb.c
	module/zfs/metaslab.c
	module/zfs/refcount.c
	module/zfs/sha256.c
	module/zfs/spa.c
	module/zfs/spa_boot.c
	module/zfs/uberblock.c
	module/zfs/vdev.c
	module/zfs/zap_micro.c
	module/zfs/zfs_ioctl.c
	module/zfs/zfs_replay.c
	module/zfs/zio.c
	module/zfs/zio_compress.c
2010-05-28 15:34:57 -07:00
Brian Behlendorf 957b7b41d4 Merge commit 'refs/top-bases/gcc-c90' into gcc-c90
Conflicts:
	cmd/zdb/zdb.c
	cmd/ztest/ztest.c
	module/zfs/dbuf.c
	module/zfs/dsl_dataset.c
	module/zfs/dsl_scrub.c
	module/zfs/spa.c
	module/zfs/vdev.c
	module/zfs/zio.c
2010-05-28 14:19:22 -07:00
Brian Behlendorf 428870ff73 Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
Brian Behlendorf 6324adf280 Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2010-05-28 12:43:01 -07:00
Brian Behlendorf 9f27168dfc Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-05-28 12:42:35 -07:00
Brian Behlendorf 002809a885 Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-05-28 12:42:31 -07:00
Brian Behlendorf 06da6ccf97 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-05-28 12:42:30 -07:00
Brian Behlendorf c91169c7c5 Merge branch 'gcc-shadow' into refs/top-bases/gcc-branch
Conflicts:
	lib/libzfs/libzfs_util.c
2010-05-28 12:42:27 -07:00
Brian Behlendorf fb72c6ef81 Revert gcc-shadow using -Wno-shadow I can live with
While I would rather fix all the instances where something is shadowed
it complicates tracking the OpenSolaris code where they either don't
seem to care or have different conflicts.  Anyway, this ends up being
more simply gratutous change than I care for.
2010-05-28 12:34:45 -07:00
Brian Behlendorf feb723fa7d Merge branch 'linux-events' into refs/top-bases/linux-zfs-branch 2010-05-14 12:55:10 -07:00
Brian Behlendorf 97d19a5e45 Add linux-events topic branch for zevent handling.
This topic branch leverages the Solaris style FMA call points
in ZFS to create a user space visible event notification system
under Linux.  This new system is called zevent and it unifies
all previous Solaris style ereports and sysevent notifications.

Under this Linux specific scheme when a sysevent or ereport event
occurs an nvlist describing the event is created which looks almost
exactly like a Solaris ereport.  These events are queued up in the
kernel when they occur and conditionally logged to the console.
It is then up to a user space application to consume the events
and do whatever it likes with them.

To make this possible the existing /dev/zfs ABI has been extended
with two new ioctls which behave as follows.

* ZFS_IOC_EVENTS_NEXT
Get the next pending event.  The kernel will keep track of the last
event consumed by the file descriptor and provide the next one if
available.  If no new events are available the ioctl() will block
waiting for the next event.  This ioctl may also be called in a
non-blocking mode by setting zc.zc_guid = ZEVENT_NONBLOCK.  In the
non-blocking case if no events are available ENOENT will be returned.
It is possible that ESHUTDOWN will be returned if the ioctl() is
called while module unloading is in progress.  And finally ENOMEM
may occur if the provided nvlist buffer is not large enough to
contain the entire event.

* ZFS_IOC_EVENTS_CLEAR
Clear are events queued by the kernel.  The kernel will keep a fairly
large number of recent events queued, use this ioctl to clear the
in kernel list.  This will effect all user space processes consuming
events.

The zpool command has been extended to use this events ABI with the
'events' subcommand.  You may run 'zpool events -v' to output a
verbose log of all recent events.  This is very similar to the
Solaris 'fmdump -ev' command with the key difference being it also
includes what would be considered sysevents under Solaris.  You
may also run in follow mode with the '-f' option.  To clear the
in kernel event queue use the '-c' option.

$ sudo cmd/zpool/zpool events -fv
TIME                        CLASS
May 13 2010 16:31:15.777711000 ereport.fs.zfs.config.sync
        class = "ereport.fs.zfs.config.sync"
        ena = 0x40982b7897700001
        detector = (embedded nvlist)
                version = 0x0
                scheme = "zfs"
                pool = 0xed976600de75dfa6
        (end detector)

        time = 0x4bec8bc3 0x2e5aed98
        pool = "zpios"
        pool_guid = 0xed976600de75dfa6
        pool_context = 0x0

While the 'zpool events' command is handy for interactive debugging
it is not expected to be the primary consumer of zevents.  This ABI
was primarily added to facilitate the addition of a user space
monitoring daemon.  This daemon would consume all events posted by
the kernel and based on the type of event perform an action.  For
most events simply forwarding them on to syslog is likely enough.
But this interface also cleanly allows for more sophisticated
actions to be taken such as generating an email for a failed drive
2010-05-14 12:40:44 -07:00
Brian Behlendorf 9c9f3480ad Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-04-29 10:42:47 -07:00
Brian Behlendorf 86705eb3e0 Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2010-04-29 10:42:39 -07:00
Brian Behlendorf 91b582d4a1 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2010-04-29 10:42:02 -07:00
Brian Behlendorf 1368594e11 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-04-29 10:41:59 -07:00
Brian Behlendorf a3c2fb2333 Merge commit 'refs/top-bases/gcc-shadow' into gcc-shadow 2010-04-29 10:41:02 -07:00
Brian Behlendorf 8c24800b72 Merge branch 'gcc-c90' into refs/top-bases/gcc-branch 2010-04-29 10:40:36 -07:00
Brian Behlendorf 4aad8d3244 Merge commit 'refs/top-bases/gcc-c90' into gcc-c90 2010-04-29 10:40:34 -07:00
Brian Behlendorf fa42225a3d Add Solaris FMA style support 2010-04-29 10:37:15 -07:00
Brian Behlendorf 1a6447c024 Merge branch 'linux-have-sysevent' into refs/top-bases/linux-zfs-branch 2010-03-22 16:56:32 -07:00
Brian Behlendorf c9aaaff23b Move zfs_config.h include to command line -include
Remove the few places in the code where zfs_config.h is included.
It is now added to the gcc compile line to ensure the config results
are always available.
2010-03-22 16:48:16 -07:00
Brian Behlendorf 5f863d5936 Merge branch 'linux-have-sysevent' into refs/top-bases/linux-zfs-branch 2010-03-08 10:51:39 -08:00
Brian Behlendorf 7121867aea Configure checks for kernel build options incompatible with the license
Changes for linux-kernel-module topic branch, see commit fd75782.
2010-03-08 10:45:19 -08:00
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 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 cd01e2a6c9 Merge branch 'linux-have-sysevent' into refs/top-bases/linux-zfs-branch 2009-10-01 17:08:00 -07:00
Brian Behlendorf 6e2c55b5a6 Update to use spl_module_{init,exit}() macro API. 2009-10-01 16:47:49 -07:00
Brian Behlendorf 6e43f5a80b Merge commit 'refs/top-bases/linux-have-zpl' into linux-have-zpl
Conflicts:

	module/zfs/rrwlock.c
	module/zfs/zfs_ioctl.c
2009-08-18 12:59:17 -07:00
Brian Behlendorf 954484f75d Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module
Conflicts:

	module/zfs/dsl_dataset.c
	module/zfs/spa_history.c
2009-08-18 12:32:53 -07:00
Brian Behlendorf c67303e092 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch
Conflicts:

	lib/libzfs/libzfs_dataset.c
	module/zfs/dsl_dataset.c
	module/zfs/rrwlock.c
	module/zfs/spa_history.c
	module/zfs/zfs_ioctl.c
2009-08-18 12:26:09 -07:00
Brian Behlendorf 50c623ccef Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2009-08-18 12:10:55 -07:00
Brian Behlendorf db89339134 Merge commit 'refs/top-bases/gcc-shadow' into gcc-shadow
Conflicts:

	module/zfs/dmu.c
2009-08-18 12:07:23 -07:00