summaryrefslogtreecommitdiff
path: root/bitmap.c
Commit message (Collapse)AuthorAgeFilesLines
* Subject: bitmap: used 4K aligned buffers when reading the bitmap.NeilBrown2011-12-231-1/+1
| | | | | | | | | This is needed on 4K block devices such as DASD as we do O_DIRECT reads. Do the same alignment for gpt just to be safe. Signed-off-by: NeilBrown <neilb@suse.de>
* bitmap: print correct percentage of bitmap in use.NeilBrown2011-12-231-1/+1
| | | | | | | | We were adding 1, presumably to avoid div-by-zero possibilities. It is better to only substitute '1' if the value actually is zero, else for small numbers of bits the difference is visible. Signed-off-by: NeilBrown <neilb@suse.de>
* bitmap_fd_read(): fix memory leakJes Sorensen2011-11-021-0/+3
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Compile with -Wextra by defaultNeilBrown2010-08-051-1/+1
| | | | | | This produced lots of warning, some of which pointed to actual bugs. Signed-off-by: NeilBrown <neilb@suse.de>
* Cast to long long before left-shifting too much.NeilBrown2010-07-221-1/+1
| | | | | | | | | | | | | When left-shifting we must be sure that the value being shifted is large enough to not lose bits. The 'chunkssize' in CreateBitmap is only 'long' so it can overflow. So cast to 'long long' first. Also fix a similar issue in Detail even though it isn't currently being compiled. Signed-off-by: NeilBrown <neilb@suse.de> Reported-by: Tomasz Chmielewski <mangoo@wpkg.org>
* Don't attempt to create or read bitmaps where the metadata doesn't support it.NeilBrown2010-04-071-2/+6
| | | | | | | In particular, if the relevant bitmap method is NULL, don't try to call it, print an error instead. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: add support for checkpointing via 'curr_migr_unit'Dan Williams2009-12-211-2/+0
| | | | | | | | Unlike native md checkpointing some data about the geometry and type of the migration process is coded into curr_migr_unit. Provide logic to convert between md/{resync_start|recovery_start} and imsm/curr_migr_unit. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Merge branch 'master' into devel-3.0NeilBrown2009-05-111-13/+15
|\ | | | | | | | | | | | | | | Conflicts: Build.c mdadm.c mdadm.h super1.c
| * Fix gcc-4.4 compiler warning.NeilBrown2009-04-291-13/+15
| | | | | | | | | | | | | | | | | | Apparently the dereferencing of a type-punned pointer breaks strict aliasing rules. And we wouldn't want to do that. So just make a different array of the appropriate type and use memcpy. Resolves-Debian-bug: 505375 Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into devel-3.0NeilBrown2009-02-021-1/+1
|\ \ | |/
| * Fix possible crash if bitmap metadata is bad.NeilBrown2009-02-021-1/+1
| | | | | | | | | | | | | | | | | | We really should never divide by 0. Thanks to "Jon Nelson" <jnelson-linux-raid@jamponi.net> for finding the problem. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into devel-3.0NeilBrown2008-10-171-0/+9
|\ \ | |/ | | | | | | | | Conflicts: Manage.c
| * Manage: allow adding device that is just large enough to v1.x array.NeilBrown2008-10-131-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | When adding a device to an array, we check that it is large enough. Currently the check makes sure there is also room for a reasonably sized bitmap. But if the array doesn't have a bitmap, then this test might be too restrictive. So when adding, only insist there is enough space for the current bitmap. When Creating, still require room for the standard sized bitmap. This resolved Debian Bug 500309
* | trivial warn_unused_result squashingDan Williams2008-10-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made the mistake of recompiling the F9 mdadm rpm which has a patch to remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots of errors: config.c:568: warning: ignoring return value of asprintf Assemble.c:411: warning: ignoring return value of asprintf Assemble.c:413: warning: ignoring return value of asprintf super0.c:549: warning: ignoring return value of posix_memalign super0.c:742: warning: ignoring return value of posix_memalign super0.c:812: warning: ignoring return value of posix_memalign super1.c:692: warning: ignoring return value of posix_memalign super1.c:1039: warning: ignoring return value of posix_memalign super1.c:1155: warning: ignoring return value of posix_memalign super-ddf.c:508: warning: ignoring return value of posix_memalign super-ddf.c:645: warning: ignoring return value of posix_memalign super-ddf.c:696: warning: ignoring return value of posix_memalign super-ddf.c:715: warning: ignoring return value of posix_memalign super-ddf.c:1476: warning: ignoring return value of posix_memalign super-ddf.c:1603: warning: ignoring return value of posix_memalign super-ddf.c:1614: warning: ignoring return value of posix_memalign super-ddf.c:1842: warning: ignoring return value of posix_memalign super-ddf.c:2013: warning: ignoring return value of posix_memalign super-ddf.c:2140: warning: ignoring return value of write super-ddf.c:2143: warning: ignoring return value of write super-ddf.c:2147: warning: ignoring return value of write super-ddf.c:2150: warning: ignoring return value of write super-ddf.c:2162: warning: ignoring return value of write super-ddf.c:2169: warning: ignoring return value of write super-ddf.c:2172: warning: ignoring return value of write super-ddf.c:2176: warning: ignoring return value of write super-ddf.c:2181: warning: ignoring return value of write super-ddf.c:2686: warning: ignoring return value of posix_memalign super-ddf.c:2690: warning: ignoring return value of write super-ddf.c:3070: warning: ignoring return value of posix_memalign super-ddf.c:3254: warning: ignoring return value of posix_memalign bitmap.c:128: warning: ignoring return value of posix_memalign mdmon.c:94: warning: ignoring return value of write mdmon.c:221: warning: ignoring return value of pipe mdmon.c:327: warning: ignoring return value of write mdmon.c:330: warning: ignoring return value of chdir mdmon.c:335: warning: ignoring return value of dup monitor.c:415: warning: rv may be used uninitialized in this function ...some of these like the write() ones are not so trivial so save those fixes for the next patch. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Use O_DIRECT for all IO to devices.Neil Brown2008-07-121-4/+2
|/ | | | | | | | Using buffered IO risks non-atomic updates to parts of the device that we don't actually want to write to. This isn't in general safe. So switch to O_DIRECT for all that IO and make sure we have properly aligned buffers.
* Drop the superblock arg from all metadata methods.Neil Brown2007-12-141-1/+1
| | | | It is now in the 'supertype'
* Remove spaces/tabs from ends of lines.Neil Brown2007-12-141-3/+3
|
* Centralise code for copying uuidNeil Brown2006-12-141-12/+1
| | | | Rather than opencoding the byteswap all the time.
* Fix and test --update=uuidNeil Brown2006-12-141-5/+25
| | | | A number of odd bugs here, but now we have a regression test as well.
* Reduce max bitmap size when bitmap is in a file.Neil Brown2006-10-161-3/+4
| | | | To ensure kernel never needs to allocate more than 1 page contiguously.
* Flush bitmap file before truncate.Neil Brown2006-10-161-0/+1
| | | | | Otheriwse the last write happens on fclose which is after ftruncate, to the truncate has no effect.
* Fixed endian problem with bitmap metdataPaul Clements2006-10-091-0/+1
| | | | From: Paul Clements <paul.clements@steeleye.com>
* check return status of all write/fwrite functions as required by glibc 2.4Neil Brown2006-05-291-6/+12
| | | | | | | | | | | | From: Luca Berra <bluca@vodka.it> glibc 2.4 is pedantic on ignoring return values from fprintf, fwrite and write, so now we check the rval and actually do something with it. in the Grow.c case i only print a warning, since i don't think we can do anything in case we fail invalidating those superblocks (is should never happen, but then...) Signed-off-by: Neil Brown <neilb@suse.de>
* When updating uuid, update the bitmap as well - external bitmapsNeil Brown2006-05-161-0/+14
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Limit size of bitmap to 2million chunks.Neil Brown2006-05-151-0/+11
| | | | | | | | When creating a file bitmap, choose a default size that results in fewer than 2^21 chunks. Without this kmalloc failure in the kernel becomes likely. Signed-off-by: Neil Brown <neilb@suse.de>
* Use O_DIRECT to read bitmap files.Neil Brown2006-05-151-18/+41
| | | | | | | | A pending patch to the kernel causes bitmap file updates to not go through the page cache, so O_DIRECT is needed to ensure that we read current data. Signed-off-by: Neil Brown <neilb@suse.de>
* Release some compile fixes.Neil Brown2006-02-061-2/+2
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Assorted fixes...Neil Brown2006-01-271-0/+5
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* Support bitmaps with raid10Neil Brown2005-11-221-5/+6
| | | | | | And a couple of other little things Signed-off-by: Neil Brown <neilb@suse.de>
* Create version-4 bitmaps if kernel supports it.Neil Brown2005-10-111-3/+5
| | | | | | | Version-3 bitmaps are host-endian. Version-4 are little-endian and so more portable. Signed-off-by: Neil Brown <neilb@suse.de>
* Fix remaining problems with hot-add bitmap to version-1 superblockNeil Brown2005-09-121-1/+1
| | | | | | Also some more tests - r5 and r6 bitmaps Signed-off-by: Neil Brown <neilb@suse.de>
* Passes all tests, nearly ready for release.Neil Brown2005-08-261-3/+3
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Getting ready for 2.0 release...Neil Brown2005-08-261-3/+3
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Support internal bitmaps with format-1 superblocks.Neil Brown2005-08-251-2/+25
| | | | Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Add write-behind supportNeil Brown2005-08-091-0/+8
| | | | | | | | Currently this includes --write-behind to set level of write-behind supported --write-mostly to flag devices as write-mostly. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Assorted Fixes for multiple bugs.Neil Brown2005-08-041-2/+2
| | | | | | | Assemble would crash, or just not work. A few other problem found by a new test-suite. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Replace sprintf calls with snprintfNeil Brown2005-06-141-1/+1
| | | | | | To quiet diet-libc Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Add support for internal bitmapsNeil Brown2005-06-071-3/+15
| | | | | | For version 0.90 superblocks, an internal bitmap can be specified at create. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
* Initial bitmap supportNeil Brown2005-06-071-0/+315
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>