Commit Graph

2750 Commits

Author SHA1 Message Date
Brian Behlendorf 48d1b0c5ab Cleanly integrate ZFS tools with libblkid.
The majority of this this patch concerns itself with doing a direct
replacement of Solaris's libdiskmgt library with libblkid+libefi.
You'll notice that this patch removes all libdiskmgt code instead of
ifdef'ing it out.  This was done to minimize any confusion when reading
the code because it seems unlikely we will ever port libdiskmgt to Linux.

Despite the replacement the behavior of the tools should have remained
the same with one exception.  For the moment, we are unable to check
the partitions of devices which have an MBR style partition table when
creating a filesystem.  If a non-efi partition sceme is detected on a
whole disk device we prompt the user to explicity use the force option.
It would not be a ton of work to make the tool aware of MBR style
partitions if this becomes a problem.

I've done basic sanity checking for various configurations and all
the issues I'm aware of have been addressed.  Even things like blkid
misidentifing a disk as ext3 when it is added to a zfs pool.  I'm
careful to always zero out the first 4k of any new zfs partition.  That
all said this is all new code and while it looks like it's working right
for me we should keep an eye on it for any strange behavior.
2009-10-15 16:28:47 -07:00
Brian Behlendorf a09d33e929 Update build system for libblkid integration 2009-10-15 16:25:18 -07:00
Brian Behlendorf 992be351d5 Changes required to integrate libefi in to Linux.
The major change here is to fix up libefi to be linux aware.  For
the most part this wasn't too hard but there were a few major issues.

First off I needed to handle the DKIOCGMEDIAINFO and DKIOCINFO ioctls.
There is no direct equivilant for these ioctls under linux.  To handle
this I added wrapper functions which under Solaris simple call the ioctls.
But under Linux dig around the system a little bit getting the needed
info to fill in the requested structures.

Secondly the efi_ioctl() call was adapted such that under linux it directly
read or writes out the partition table.  Under Solaris this work was
handed off to the kernel via an ioctl.  In the efi_write() case we also
ensure we prompt the kernel via BLKRRPART to re-scan the new partition
table.  The libefi generated partition tables are correct but older
versions of ~parted-1.8.1 can not read them without a small patch.
The kernel and fdisk are able to read them just fine.

Thirdly efi_alloc_and_init() which is used by zpool to determine if a
device is a 'wholedisk' was updated to be linux aware.  This check is
performed by using the partition number for the device, which the
partition number is 0 on linux it is a 'wholedisk'.  However, certain
device type such as the loopback and ram disks needed to be excluded
because they do not support partitioning.

Forthly the zpool command was made symlink aware so it can correctly
resolve udev entries such as /dev/disk/by-*/*.  This symlinks are
fully expanded ensuring all block devices are recognized.  When a
when a 'wholedisk' block device is detected we now properly write
out an efi label and place zfs in the first partition (0th slice).
This partition is created 1MiB in to the disk to ensure it is aligned
nicely with all high end block devices I'm aware of.

This all works for me now but it did take quite a bit of work to get
it all sorted out.  It would not surprise me if certain special cases
were missed so we should keep any eye of for any odd behavior.
2009-10-14 16:07:48 -07:00
Brian Behlendorf 245e7692f7 Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-14 15:58:55 -07:00
Brian Behlendorf 085ed9fe82 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2009-10-14 15:57:10 -07:00
Brian Behlendorf cb678c0b31 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2009-10-14 15:57:09 -07:00
Brian Behlendorf 9ea3f53d0c Merge commit 'refs/top-bases/gcc-branch' into gcc-branch 2009-10-14 15:57:09 -07:00
Brian Behlendorf a8adb61c00 Merge branch 'gcc-ident-pragmas' into refs/top-bases/gcc-branch 2009-10-14 15:57:08 -07:00
Brian Behlendorf 09a8c99097 Additional build system update for libefi library.
This include updating all the Makefile.am to have the correct
include paths and libraries.  In addition, the zlib m4 macro was
updated to more correctly integrate with the Makefiles.  And I
added two new macros libblkid and libuuid which will be needed by
subsequent commits for blkid and uuid support respectively.  The
blkid support is optional, the uuid support is mandatory for libefi.
2009-10-14 15:47:41 -07:00
Brian Behlendorf 39d85a8b94 Remove pragmas from new libefi files. 2009-10-14 15:44:22 -07:00
Brian Behlendorf 81ec3f8951 Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-09 16:43:53 -07:00
Brian Behlendorf cb91bbe6ce Additional set of build system tweaks for libefi library. 2009-10-09 16:37:32 -07:00
Brian Behlendorf 7c073d0a7d Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-09 16:09:54 -07:00
Brian Behlendorf a0337cfcd8 Add libefi library in to the build system. 2009-10-09 15:58:45 -07:00
Brian Behlendorf 503c5eeb2d Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-09 15:45:22 -07:00
Brian Behlendorf e0e0f0ea84 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2009-10-09 15:43:33 -07:00
Brian Behlendorf 2b2fd27e18 Merge branch 'feature-branch' into refs/top-bases/zfs-branch 2009-10-09 15:43:32 -07:00
Brian Behlendorf ad0f8481d2 Merge commit 'refs/top-bases/feature-branch' into feature-branch 2009-10-09 15:43:31 -07:00
Brian Behlendorf b60766e22f Merge branch 'feature-pthreads' into refs/top-bases/feature-branch 2009-10-09 15:43:31 -07:00
Brian Behlendorf 7698515ec4 Merge commit 'refs/top-bases/feature-pthreads' into feature-pthreads 2009-10-09 15:43:30 -07:00
Brian Behlendorf 6df047f11f Merge commit 'refs/top-bases/feature-commit-cb' into feature-commit-cb 2009-10-09 15:43:30 -07:00
Brian Behlendorf 656d8f6b22 Merge commit 'refs/top-bases/feature-zap-cursor-to-key' into feature-zap-cursor-to-key 2009-10-09 15:43:28 -07:00
Brian Behlendorf 46fa16ed8c Merge branch 'feature-zap-cursor-to-key' into refs/top-bases/feature-branch 2009-10-09 15:43:28 -07:00
Brian Behlendorf 46b272f2c4 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2009-10-09 15:43:25 -07:00
Brian Behlendorf 1b7a8f5e26 Merge commit 'refs/top-bases/fix-branch' into fix-branch 2009-10-09 15:43:24 -07:00
Brian Behlendorf 873470861e Merge commit 'refs/top-bases/fix-acl' into fix-acl 2009-10-09 15:43:23 -07:00
Brian Behlendorf a4c68aa767 Merge branch 'fix-acl' into refs/top-bases/fix-branch 2009-10-09 15:43:23 -07:00
Brian Behlendorf 27c7573a5e Merge branch 'fix-deadcode' into refs/top-bases/fix-branch 2009-10-09 15:43:22 -07:00
Brian Behlendorf 6d3da13a7d Merge commit 'refs/top-bases/fix-deadcode' into fix-deadcode 2009-10-09 15:43:21 -07:00
Brian Behlendorf 69d396e7e0 Merge commit 'refs/top-bases/fix-strncat' into fix-strncat 2009-10-09 15:43:20 -07:00
Brian Behlendorf 00699175eb Merge branch 'fix-strncat' into refs/top-bases/fix-branch 2009-10-09 15:43:20 -07:00
Brian Behlendorf 38a311ac31 Merge commit 'refs/top-bases/fix-list' into fix-list 2009-10-09 15:43:18 -07:00
Brian Behlendorf 3b18b22fb3 Merge branch 'fix-list' into refs/top-bases/fix-branch 2009-10-09 15:43:18 -07:00
Brian Behlendorf ed89c3baec Merge branch 'fix-taskq' into refs/top-bases/fix-branch 2009-10-09 15:43:17 -07:00
Brian Behlendorf d7d86be950 Merge commit 'refs/top-bases/fix-taskq' into fix-taskq 2009-10-09 15:43:16 -07:00
Brian Behlendorf e59c225cea Merge commit 'refs/top-bases/fix-stack' into fix-stack 2009-10-09 15:43:15 -07:00
Brian Behlendorf dbdf553198 Merge branch 'fix-stack' into refs/top-bases/fix-branch 2009-10-09 15:43:15 -07:00
Brian Behlendorf 49529232e1 Merge commit 'refs/top-bases/fix-rwlocks' into fix-rwlocks 2009-10-09 15:43:13 -07:00
Brian Behlendorf 3d7d195f48 Merge branch 'fix-rwlocks' into refs/top-bases/fix-branch 2009-10-09 15:43:13 -07:00
Brian Behlendorf 1719b6ee81 Merge branch 'fix-no-zmod' into refs/top-bases/fix-branch 2009-10-09 15:43:12 -07:00
Brian Behlendorf dd666623a4 Merge commit 'refs/top-bases/fix-no-zmod' into fix-no-zmod 2009-10-09 15:43:11 -07:00
Brian Behlendorf fb2c44bdfc Merge commit 'refs/top-bases/fix-newlines' into fix-newlines 2009-10-09 15:43:10 -07:00
Brian Behlendorf 1d88115083 Merge branch 'fix-newlines' into refs/top-bases/fix-branch 2009-10-09 15:43:10 -07:00
Brian Behlendorf 1af5dcae21 Merge commit 'refs/top-bases/fix-get-configs' into fix-get-configs 2009-10-09 15:43:08 -07:00
Brian Behlendorf 8dc9c727ad Merge branch 'fix-get-configs' into refs/top-bases/fix-branch 2009-10-09 15:43:08 -07:00
Brian Behlendorf a8c1c53084 Merge branch 'fix-evict-dbufs' into refs/top-bases/fix-branch 2009-10-09 15:43:07 -07:00
Brian Behlendorf 7cfd9ab530 Merge commit 'refs/top-bases/fix-evict-dbufs' into fix-evict-dbufs 2009-10-09 15:43:06 -07:00
Brian Behlendorf 1004439a17 Merge commit 'refs/top-bases/fix-dsl_pool_t' into fix-dsl_pool_t 2009-10-09 15:43:05 -07:00
Brian Behlendorf b66f239d85 Merge branch 'fix-dsl_pool_t' into refs/top-bases/fix-branch 2009-10-09 15:43:05 -07:00
Brian Behlendorf 08328c349b Merge commit 'refs/top-bases/fix-dnode-cons' into fix-dnode-cons 2009-10-09 15:43:03 -07:00