Add linux kernel disk support

Native Linux vdev disk interfaces

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf
2010-08-26 11:45:02 -07:00
parent 325f023544
commit 60101509ee
27 changed files with 2575 additions and 116 deletions
+8 -6
View File
@@ -701,12 +701,12 @@ typedef struct ddt_histogram {
#define ZFS_DEV "/dev/zfs"
/* general zvol path */
#define ZVOL_DIR "/dev/zvol"
/* expansion */
#define ZVOL_PSEUDO_DEV "/devices/pseudo/zfs@0:"
/* for dump and swap */
#define ZVOL_FULL_DEV_DIR ZVOL_DIR "/dsk/"
#define ZVOL_FULL_RDEV_DIR ZVOL_DIR "/rdsk/"
#define ZVOL_DIR "/dev"
#define ZVOL_MAJOR 230
#define ZVOL_MINOR_BITS 4
#define ZVOL_MINOR_MASK ((1U << ZVOL_MINOR_BITS) - 1)
#define ZVOL_MINORS (1 << 4)
#define ZVOL_PROP_NAME "name"
#define ZVOL_DEFAULT_BLOCKSIZE 8192
@@ -740,6 +740,8 @@ typedef enum zfs_ioc {
ZFS_IOC_DATASET_LIST_NEXT,
ZFS_IOC_SNAPSHOT_LIST_NEXT,
ZFS_IOC_SET_PROP,
ZFS_IOC_CREATE_MINOR,
ZFS_IOC_REMOVE_MINOR,
ZFS_IOC_CREATE,
ZFS_IOC_DESTROY,
ZFS_IOC_ROLLBACK,
+28 -1
View File
@@ -142,9 +142,22 @@ dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
* which is the same as MAXNAMELEN used in the kernel.
* If ZFS_MAXNAMELEN value is changed, make sure to cleanup all
* places using MAXNAMELEN.
*
* When HAVE_KOBJ_NAME_LEN is defined the maximum safe kobject name
* length is 20 bytes. This 20 bytes is broken down as follows to
* provide a maximum safe <pool>/<dataset>[@snapshot] length of only
* 18 bytes. To ensure bytes are left for <dataset>[@snapshot] the
* <pool> portition is futher limited to 9 bytes. For 2.6.27 and
* newer kernels this limit is set to MAXNAMELEN.
*
* <pool>/<dataset> + <partition> + <newline>
* (18) + (1) + (1)
*/
#ifdef HAVE_KOBJ_NAME_LEN
if (strlen(path) > 18) {
#else
if (strlen(path) >= MAXNAMELEN) {
#endif /* HAVE_KOBJ_NAME_LEN */
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);
@@ -303,8 +316,22 @@ pool_namecheck(const char *pool, namecheck_err_t *why, char *what)
* which is the same as MAXNAMELEN used in the kernel.
* If ZPOOL_MAXNAMELEN value is changed, make sure to cleanup all
* places using MAXNAMELEN.
*
* When HAVE_KOBJ_NAME_LEN is defined the maximum safe kobject name
* length is 20 bytes. This 20 bytes is broken down as follows to
* provide a maximum safe <pool>/<dataset>[@snapshot] length of only
* 18 bytes. To ensure bytes are left for <dataset>[@snapshot] the
* <pool> portition is futher limited to 8 bytes. For 2.6.27 and
* newer kernels this limit is set to MAXNAMELEN.
*
* <pool>/<dataset> + <partition> + <newline>
* (18) + (1) + (1)
*/
#ifdef HAVE_KOBJ_NAME_LEN
if (strlen(pool) > 8) {
#else
if (strlen(pool) >= MAXNAMELEN) {
#endif /* HAVE_KOBJ_NAME_LEN */
if (why)
*why = NAME_ERR_TOOLONG;
return (-1);