aboutsummaryrefslogtreecommitdiff
path: root/sys/geom
Commit message (Collapse)AuthorAgeFilesLines
* Remove redundant includeBryan Drewery2014-04-291-1/+0
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=265072
* Reduce number of opens by REOM RAID during provider taste.Alexander Motin2014-04-287-20/+25
| | | | | | | | | | | | Instead opening/closing provider by each of metadata classes, do it only once in core code. Since for SCSI disks open/close means sending some SCSI commands to the device, this change reduces taste time. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=265054
* Keep geom_uncompress(4) in line with geom_uzip(4), bring in the r264504 fix.Luiz Otavio O Souza2014-04-221-5/+23
| | | | | | | | | | | | | | | | | | | Make sure not to start I/O bigger than MAXPHYS bytes. Quoting r264504: When we detect the condition, we'll reduce the block count and perform a "short" read. In g_uncompress_done() we need to consider the original I/O length and stop early if we're about to deflate a block that we didn't read. By using bio_completed in the cloned BIO and not bio_length to check for this, we automatically and gracefully handle short reads that our providers may be doing on top of the short reads we may initiate ourselves. Reviewed by: marcel Notes: svn path=/head/; revision=264769
* Make sure not to do I/O for more than MAXPHYS bytes. Doing so can causeMarcel Moolenaar2014-04-151-5/+22
| | | | | | | | | | | | | | | | | | | | | | problems in our providers, such as a KASSERT in md(4). We can initiate I/O for more than MAXPHYS bytes if we've been given a BIO for MAXPHYS bytes, the blocks from which we're reading couldn't be compressed and we had compression in preceeding blocks resulting in misalignment of the blocks we're trying to read relative to the sector. We're forced to round up the I/O length to make it an multiple of the sector size. When we detect the condition, we'll reduce the block count and perform a "short" read. In g_uzip_done() we need to consider the original I/O length and stop early if we're about to deflate a block that we didn't read. By using bio_completed in the cloned BIO and not bio_length to check for this, we automatically and gracefully handle short reads that our providers may be doing on top of the short reads we may initiate ourselves. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=264504
* Make g_access() KASSERT() more useful.Bryan Drewery2014-04-151-2/+3
| | | | | | | | | Sponsored by: EMC / Isilon Storage Division Obtained from: Isilon OneFS MFC after: 2 weeks Notes: svn path=/head/; revision=264499
* Align and round the partitionable disk space to 4K by default.Marcel Moolenaar2014-04-121-6/+29
| | | | | | | | | Since this would also apply when recovering, make sure not to align or round when that would have a partition fall outside the partitionable area. Notes: svn path=/head/; revision=264378
* Fix spelling error in g_trace() call.Bryan Drewery2014-04-101-1/+1
| | | | | | | | Sponsored by: EMC / Isilon Storage Division MFC after: 1 week Notes: svn path=/head/; revision=264320
* Fix wrong sizes used to access PD_Type and PD_State DDF metadata fields.Alexander Motin2014-04-101-17/+39
| | | | | | | | | | | This caused incorrect behavior of arrays with big-endian DDF metadata. Little-endian (like used by Adaptec controllers) should not be harmed. Add workaround should be enough to manage compatibility. MFC after: 2 weeks Notes: svn path=/head/; revision=264318
* Do not increment bio_data in case of BIO_DELETE.Alexander Motin2014-04-101-3/+10
| | | | | | | This fixes KASSERT() panic in g_io_request(). Notes: svn path=/head/; revision=264313
* An all-or-nothing approach to labels isn't flexible enough. EmbeddedMarcel Moolenaar2014-04-061-2/+6
| | | | | | | | | | | systems need fine-grained control over what's in and what's out. That's ideal. For now, separate GPT labels from the rest and allow g_label to be built with just GPT labels. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=264185
* Make sure we don't free memory that's already been freed by settingMarcel Moolenaar2014-04-061-1/+4
| | | | | | | | | | the geom->softc pounter to NULL before freeing the g_slicer softc. In g_slicer_free() the pointer is checked first. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=264184
* Show error code when failing to destroy a mirror on delayBryan Drewery2014-04-051-1/+2
| | | | | | | | Sponsored by: EMC / Isilon Storage Division MFC after: 2 weeks Notes: svn path=/head/; revision=264142
* In g_eli_crypto_hmac_init(), zero out after using the ipad buffer,Xin LI2014-02-081-0/+1
| | | | | | | | | | | | | | | | k_ipad. Note that the two consumers in geli(4) are not affected by this issue because the way the code is constructed and as such, we believe there is no security impact with or without this change with geli(4)'s usage. Reported by: Serge van den Boom <serge vdboom.org> Reviewed by: pjd MFC after: 2 weeks Notes: svn path=/head/; revision=261618
* Fix the build with DEBUG enabled. Where possible, fix style(9) issues.Luiz Otavio O Souza2014-02-072-51/+58
| | | | | | | | Reviewed by: bde Approved by: adrian (mentor) Notes: svn path=/head/; revision=261586
* Fix a logic error. Because of this inflateReset() wasn't being called andLuiz Otavio O Souza2014-02-031-1/+1
| | | | | | | | | | | | | the output buffer wasn't being cleared between the inflate() calls, producing zeroed output after the first inflate() call. This fixes the read of mkuzip(8) images with geom_uncompress(4). Reviewed by: ray Approved by: adrian (mentor) Notes: svn path=/head/; revision=261440
* Remove some unnecessary code. The offsets read from the first block areLuiz Otavio O Souza2014-02-031-10/+4
| | | | | | | | | | overwritten a few lines bellow. Reviewed by: ray Approved by: adrian (mentor) Notes: svn path=/head/; revision=261439
* Always free sbuf in gctl_free().Andrey V. Elsukov2014-01-231-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=261091
* Remove another unneeded NULL check from geom_alloc_copyin().Andrey V. Elsukov2014-01-231-15/+15
| | | | | | | | | | Do copyout in case of gctl version mismatch and fix sbuf leak in g_ctl_ioctl_ctl(). MFC after: 1 week Notes: svn path=/head/; revision=261089
* In gctl_copyin() remove unused error variable.Andrey V. Elsukov2014-01-231-8/+9
| | | | | | | | | | | geom_alloc_copyin() can't return ENOMEM, so describe its fail as bad control request. Add check for NULL pointer in gctl_dump(), since it can be NULL when geom_alloc_copyin() failed. MFC after: 1 week Notes: svn path=/head/; revision=261086
* Fix typo in r261084.Andrey V. Elsukov2014-01-231-6/+7
| | | | | | | | | | | | Add to the gctl_error() an ability to specify error description even if numeric error code is already specified. Also by default set error code to EINVAL. PR: 185852 MFC after: 1 week Notes: svn path=/head/; revision=261085
* malloc() with M_WAITOK doesn't return NULL.Andrey V. Elsukov2014-01-231-4/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=261084
* Removed unneeded and dangerous assignment. It would probably cause NULLAlexander Motin2014-01-191-1/+0
| | | | | | | | | | refererence panic if compiler not optimize it out. Found with: Clang static analyzer MFC after: 2 weeks Notes: svn path=/head/; revision=260883
* Build the geom_uncompress(4) module by default.Luiz Otavio O Souza2014-01-101-1/+1
| | | | | | | | | | | | | | | | Fix geom_uncompress(4) module loading. Don't link zlib.c (which is a module itself) directly. The built module was verified and used to read a few mkulzma(8) images on amd64 to validate some of the informations on the manual page. While here, don't overwrite CFLAGS. Reviewed by: ray Approved by: adrian (mentor) Notes: svn path=/head/; revision=260523
* Add an ability to stop gmirror and clear its metadata in one command.Andrey V. Elsukov2013-12-273-4/+13
| | | | | | | | | | | | | | | | | This fixes the problem, when gmirror starts again just after stop. The problem occurs when gmirror's component has geom label with equal size. E.g. gpt and gptid have the same size as partition, diskid has the same size as entire disk. When gmirror's geom has been destroyed, glabel creates its providers and this initiate retaste. Now "gmirror destroy" command is available. It destroys geom and also erases gmirror's metadata. MFC after: 2 weeks Notes: svn path=/head/; revision=259929
* Add GPT UUID for VMware vSAN meta-data partition.Dmitry Morozovsky2013-12-263-0/+4
| | | | | | | | Approved by: ae MFC after: 2 weeks Notes: svn path=/head/; revision=259925
* Prevent users from deactivating the last component of a mirror.Andrey V. Elsukov2013-12-191-1/+12
| | | | | | | | PR: 184985 MFC after: 1 week Notes: svn path=/head/; revision=259634
* Clear some more places with potentially sensitive data.Pawel Jakub Dawidek2013-12-151-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=259429
* Clear content of keyfiles loaded by the loader after processing them.Pawel Jakub Dawidek2013-12-151-0/+1
| | | | | | | | Pointed out by: rwatson MFC after: 1 week Notes: svn path=/head/; revision=259428
* Fix bug introduced at r256607. We have to recalculate bp_resid here sinceAlexander Motin2013-12-121-1/+1
| | | | | | | | | sizes of original and completed requests may differ due to end of media. Bisected by: pho Notes: svn path=/head/; revision=259247
* Partially revert r259080. bde@ pointed out that there are a lot more style bugsJustin Hibbits2013-12-082-2/+2
| | | | | | | | | | | going on in here than can be fixed, and I introduced some of my own. Rather than fix the whole host of them, back out my bugs. Found by: bde X-MFC with: r259080 Notes: svn path=/head/; revision=259096
* Fix some integer signs. These unsigned integers should all be signed.Justin Hibbits2013-12-072-2/+2
| | | | | | | Found by: clang (powerpc64) Notes: svn path=/head/; revision=259080
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thisEitan Adler2013-11-301-3/+3
| | | | | | | | | | | | | | | | shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva Notes: svn path=/head/; revision=258780
* Escape special XML chars, returned by some devices, confusing XML parsers.Alexander Motin2013-11-273-22/+42
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=258683
* Have the GPT probe return a lower priority when the MBR is not a PMBRMarcel Moolenaar2013-11-211-5/+15
| | | | | | | | | | | | | | The purpose of the PMBR is to have the disk appear in use to GPT unaware utilities (like fdisk). However, if the PMBR has been changed by a GPT unaware utlity then we must assume that this was deliberate (as it involved removal of the special slice) and we should not treat the unmodified GPT-specific sectors as being valid. By lowering the probe priority in that case, the MBR scheme will take precedence and the kernel will end up using the MBR and not the GPT. We will still use the GPT if the kernel does not support the MBR scheme. Notes: svn path=/head/; revision=258448
* Add "resize" verb to gmirror(8) and such functionality to geom_mirror(4).Andrey V. Elsukov2013-11-192-5/+106
| | | | | | | | | | | | Now it is easy to expand the size of the mirror when all its components are replaced. Also add g_resize method to geom_mirror class. It will write updated metadata to new last sector, when parent provider is resized. Silence from: geom@ MFC after: 1 month Notes: svn path=/head/; revision=258357
* In addition to r258220 allow shrinking in "automatic" mode if there isAlexander Motin2013-11-171-35/+47
| | | | | | | | | | | | already valid metadata found at the new location. This should allow easy transparent recovery if first resize was done by mistake. While there, unify metadata write code and fix minor memory leak. MFC after: 1 month Notes: svn path=/head/; revision=258251
* Implement automatic live resize support for GEOM MULTIPATH class.Alexander Motin2013-11-162-13/+93
| | | | | | | | | | | | In "manual" mode just automatically resize provider in any direction. In "automatic" mode allow only growth (with new metadata write); in case of shrinking destroy the multipath device same as before since it may be undesirable to write new metadata within old user area. MFC after: 1 month Notes: svn path=/head/; revision=258220
* Add missing line breaks.Andrey V. Elsukov2013-11-111-2/+2
| | | | | | | | PR: 181900 MFC after: 1 week Notes: svn path=/head/; revision=257965
* When zero'ing out a buffer, make sure we are using right size.Xin LI2013-11-021-4/+4
| | | | | | | | | | | | | | | | | | Without this change, in the worst but unlikely case scenario, certain administrative operations, including change of configuration, set or delete key from a GEOM ELI provider, may leave potentially sensitive information in buffer allocated from kernel memory. We believe that it is not possible to actively exploit these issues, nor does it impact the security of normal usage of GEOM ELI providers when these operations are not performed after system boot. Security: possible sensitive information disclosure Submitted by: Clement Lecigne <clecigne google com> MFC after: 3 days Notes: svn path=/head/; revision=257539
* Reject attempts to attack a disk device that has the old NEEDSGIANTJohn Baldwin2013-10-252-0/+8
| | | | | | | | | flag set. Reviewed by: mav Notes: svn path=/head/; revision=257131
* Improve ZFS N-way mirror read performance by using load and localitySteven Hartland2013-10-234-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | information. The existing algorithm selects a preferred leaf vdev based on offset of the zio request modulo the number of members in the mirror. It assumes the devices are of equal performance and that spreading the requests randomly over both drives will be sufficient to saturate them. In practice this results in the leaf vdevs being under utilized. The new algorithm takes into the following additional factors: * Load of the vdevs (number outstanding I/O requests) * The locality of last queued I/O vs the new I/O request. Within the locality calculation additional knowledge about the underlying vdev is considered such as; is the device backing the vdev a rotating media device. This results in performance increases across the board as well as significant increases for predominantly streaming loads and for configurations which don't have evenly performing devices. The following are results from a setup with 3 Way Mirror with 2 x HD's and 1 x SSD from a basic test running multiple parrallel dd's. With pre-fetch disabled (vfs.zfs.prefetch_disable=1): == Stripe Balanced (default) == Read 15360MB using bs: 1048576, readers: 3, took 161 seconds @ 95 MB/s == Load Balanced (zfslinux) == Read 15360MB using bs: 1048576, readers: 3, took 297 seconds @ 51 MB/s == Load Balanced (locality freebsd) == Read 15360MB using bs: 1048576, readers: 3, took 54 seconds @ 284 MB/s With pre-fetch enabled (vfs.zfs.prefetch_disable=0): == Stripe Balanced (default) == Read 15360MB using bs: 1048576, readers: 3, took 91 seconds @ 168 MB/s == Load Balanced (zfslinux) == Read 15360MB using bs: 1048576, readers: 3, took 108 seconds @ 142 MB/s == Load Balanced (locality freebsd) == Read 15360MB using bs: 1048576, readers: 3, took 48 seconds @ 320 MB/s In addition to the performance changes the code was also restructured, with the help of Justin Gibbs, to provide a more logical flow which also ensures vdevs loads are only calculated from the set of valid candidates. The following additional sysctls where added to allow the administrator to tune the behaviour of the load algorithm: * vfs.zfs.vdev.mirror.rotating_inc * vfs.zfs.vdev.mirror.rotating_seek_inc * vfs.zfs.vdev.mirror.rotating_seek_offset * vfs.zfs.vdev.mirror.non_rotating_inc * vfs.zfs.vdev.mirror.non_rotating_seek_inc These changes where based on work started by the zfsonlinux developers: https://github.com/zfsonlinux/zfs/pull/1487 Reviewed by: gibbs, mav, will MFC after: 2 weeks Sponsored by: Multiplay Notes: svn path=/head/; revision=256956
* gnop: make sure that newly allocated memory for softc is zeroedMateusz Guzik2013-10-231-1/+1
| | | | | | | | | | This prevents mtx_init from encountering non-zeros and panicking the kernel as a result. Reported by: Keith White <kwhite site.uottawa.ca> Notes: svn path=/head/; revision=256951
* Remove Giant-locked drivers support (DISKFLAG_NEEDSGIANT flag) from disk(9).Alexander Motin2013-10-222-29/+0
| | | | | | | | Since at least FreeBSD 7 we had only four of them in the base tree, and in head branch, thanks to jhb@, we have no any for more then a year. Notes: svn path=/head/; revision=256884
* Merge GEOM direct dispatch changes from the projects/camlock branch.Alexander Motin2013-10-2228-201/+427
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When safety requirements are met, it allows to avoid passing I/O requests to GEOM g_up/g_down thread, executing them directly in the caller context. That allows to avoid CPU bottlenecks in g_up/g_down threads, plus avoid several context switches per I/O. The defined now safety requirements are: - caller should not hold any locks and should be reenterable; - callee should not depend on GEOM dual-threaded concurency semantics; - on the way down, if request is unmapped while callee doesn't support it, the context should be sleepable; - kernel thread stack usage should be below 50%. To keep compatibility with GEOM classes not meeting above requirements new provider and consumer flags added: - G_CF_DIRECT_SEND -- consumer code meets caller requirements (request); - G_CF_DIRECT_RECEIVE -- consumer code meets callee requirements (done); - G_PF_DIRECT_SEND -- provider code meets caller requirements (done); - G_PF_DIRECT_RECEIVE -- provider code meets callee requirements (request). Capable GEOM class can set them, allowing direct dispatch in cases where it is safe. If any of requirements are not met, request is queued to g_up or g_down thread same as before. Such GEOM classes were reviewed and updated to support direct dispatch: CONCAT, DEV, DISK, GATE, MD, MIRROR, MULTIPATH, NOP, PART, RAID, STRIPE, VFS, ZERO, ZFS::VDEV, ZFS::ZVOL, all classes based on g_slice KPI (LABEL, MAP, FLASHMAP, etc). To declare direct completion capability disk(9) KPI got new flag equivalent to G_PF_DIRECT_SEND -- DISKFLAG_DIRECT_COMPLETION. da(4) and ada(4) disk drivers got it set now thanks to earlier CAM locking work. This change more then twice increases peak block storage performance on systems with manu CPUs, together with earlier CAM locking changes reaching more then 1 million IOPS (512 byte raw reads from 16 SATA SSDs on 4 HBAs to 256 user-level threads). Sponsored by: iXsystems, Inc. MFC after: 2 months Notes: svn path=/head/; revision=256880
* Fix build with gcc by spelling unused format string as "unused" instead of NULL.Edward Tomasz Napierala2013-10-191-1/+1
| | | | | | | MFC after: 29 days Notes: svn path=/head/; revision=256766
* Make geom_label(4) resize-aware. This fixes a situation when "gpart resize"Edward Tomasz Napierala2013-10-182-1/+13
| | | | | | | | | | | | would resize a partition, but label providers - e.g. /dev/gptid/XXX - would stay the same size. Reviewed by: mav MFC after: 1 month Sponsored by: FreeBSD Foundation Notes: svn path=/head/; revision=256724
* Add an automatic resize support to the GEOM_PART class.Andrey V. Elsukov2013-10-178-1/+138
| | | | | | | | | | | | When parent provider has been resized, the scheme specific G_PART_RESIZE method does an update of scheme's metadata. But all changes are not saved to disk, until `gpart commit` will be called. Discussed with: trasz MFC after: 1 month Notes: svn path=/head/; revision=256690
* MFprojects/camlock r256445:Alexander Motin2013-10-167-61/+90
| | | | | | | Add unmapped I/O support to GEOM RAID. Notes: svn path=/head/; revision=256610
* MFprojects/camlock r256371:Alexander Motin2013-10-161-5/+5
| | | | | | | Fix passing uninitialized bio_resid argument to g_trace(). Notes: svn path=/head/; revision=256607
* MFprojects/camlock r254907:Alexander Motin2013-10-161-3/+4
| | | | | | | | Move g_io_deliver() out of the lock, as required for direct dispatch. Move g_destroy_bio() out too to reduce lock scope even more. Notes: svn path=/head/; revision=256606