~ubuntu-branches/ubuntu/precise/mdadm/precise-updates

« back to all changes in this revision

Viewing changes to bitmap.c

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-02-09 16:53:02 UTC
  • mfrom: (1.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120209165302-bs4cfosmhoga2rpt
Tags: 3.2.3-2ubuntu1
* Merge from Debian testing. (LP: #920324)  Remaining changes:
  - Call checks in local-premount to avoid race condition with udev
    and opening a degraded array.
  - d/initramfs/mdadm-functions: Record in /run when boot-degraded 
    question has been asked so that it is only asked once
  - pass --test to mdadm to enable result codes for degraded arrays. 
  - Build udeb with -O2 on ppc64, working around a link error.
  - debian/control: we need udev and util-linux in the right version. We
    also remove the build dependency from quilt and docbook-to-man as both
    are not used in Ubuntus mdadm.
  - debian/initramfs/hook: kept the Ubuntus version for handling the absence
    of active raid arrays in <initramfs>/etc/mdadm/mdadm.conf
  - debian/initramfs/script.local-top.DEBIAN, debian/mdadm-startall,
    debian/mdadm.raid.DEBIAN: removed. udev does its job now instead.
  - debian/mdadm-startall.sgml, debian/mdadm-startall.8: documentation of
    unused startall script
  - debian/mdadm.config, debian/mdadm.postinst - let udev do the handling
    instead. Resolved merge conflict by keeping Ubuntu's version.
  - debian/mdadm.postinst, debian/mdadm.config, initramfs/init-premount:
    boot-degraded enablement; maintain udev starting of RAID devices;
    init-premount hook script for the initramfs, to provide information at
    boot
  - debian/mkconf.in is the older mkconf. Kept the Ubuntu version.
  - debian/rules: Kept Ubuntus version for installing apport hooks, not
    installing un-used startall script and for adding a udev rule
    corresponding to mdadm.
  - debian/install-rc, check.d/_numbers, check.d/root_on_raid: Ubuntu partman
    installer changes
  - debian/presubj: Dropped this unused bug reporting file. Instead use
    source_mdadm.py act as an apport hook for bug handling.
  - rename debian/mdadm.vol_id.udev to debian/mdadm.mdadm-blkid.udev so that
    the rules file ends up with a more reasonable name
  - d/p/debian-changes-3.1.4-1+8efb9d1ubuntu4: mdadm udev rule
    incrementally adds mdadm member when detected. Starting such an
    array in degraded mode is possible by mdadm -IRs. Using mdadm
    -ARs without stopping the array first does nothing when no
    mdarray-unassociated device is available. Using mdadm -IRs to
    start a previously partially assembled array through incremental
    mode. Keeping the mdadm -ARs for assembling arrays which were for
    some reason not assembled through incremental mode (i.e through
    mdadm's udev rule).

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
        void *buf;
133
133
        unsigned int n, skip;
134
134
 
135
 
        if (posix_memalign(&buf, 512, 8192) != 0) {
 
135
        if (posix_memalign(&buf, 4096, 8192) != 0) {
136
136
                fprintf(stderr, Name ": failed to allocate 8192 bytes\n");
137
137
                return NULL;
138
138
        }
147
147
                fprintf(stderr, Name ": failed to allocate %zd bytes\n",
148
148
                                sizeof(*info));
149
149
#endif
 
150
                free(buf);
150
151
                return NULL;
151
152
        }
152
153
 
154
155
                fprintf(stderr, Name ": failed to read superblock of bitmap "
155
156
                        "file: %s\n", strerror(errno));
156
157
                free(info);
 
158
                free(buf);
157
159
                return NULL;
158
160
        }
159
161
        memcpy(&info->sb, buf, sizeof(info->sb));
198
200
                total_bits = read_bits;
199
201
        }
200
202
out:
 
203
        free(buf);
201
204
        info->total_bits = total_bits;
202
205
        info->dirty_bits = dirty_bits;
203
206
        return info;
331
334
                goto free_info;
332
335
        printf("          Bitmap : %llu bits (chunks), %llu dirty (%2.1f%%)\n",
333
336
                        info->total_bits, info->dirty_bits,
334
 
                        100.0 * info->dirty_bits / (info->total_bits + 1));
 
337
                        100.0 * info->dirty_bits / (info->total_bits?:1));
335
338
free_info:
336
339
        free(info);
337
340
        return rv;