Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1
mdadm
0010-Reuse-calc_bitmap_size-to-reduce-code-size...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0010-Reuse-calc_bitmap_size-to-reduce-code-size.patch of Package mdadm
From c9846df9ac773fa90d704dd8c9af3cf7dd6c9807 Mon Sep 17 00:00:00 2001 From: Guoqing Jiang <gqjiang@suse.com> Date: Wed, 10 Jun 2015 13:42:13 +0800 Subject: [PATCH 10/11] Reuse calc_bitmap_size to reduce code size We can use the new added calc_bitmap_size func to remove some redundant lines. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de> --- super1.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/super1.c b/super1.c index 1f02265..26df83d 100644 --- a/super1.c +++ b/super1.c @@ -703,12 +703,8 @@ static int copy_metadata1(struct supertype *st, int from, int to) /* have the header, can calculate * correct bitmap bytes */ bitmap_super_t *bms; - int bits; bms = (void*)buf; - bits = __le64_to_cpu(bms->sync_size) / (__le32_to_cpu(bms->chunksize)>>9); - bytes = (bits+7) >> 3; - bytes += sizeof(bitmap_super_t); - bytes = ROUND_UP(bytes, 512); + bytes = calc_bitmap_size(bms, 512); if (n > bytes) n = bytes; } @@ -2271,11 +2267,7 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update memset(buf, 0xff, 4096); memcpy(buf, (char *)bms, sizeof(bitmap_super_t)); - towrite = __le64_to_cpu(bms->sync_size) / (__le32_to_cpu(bms->chunksize)>>9); - towrite = (towrite+7) >> 3; /* bits to bytes */ - towrite += sizeof(bitmap_super_t); - /* we need the bitmaps to be at 4k boundary */ - towrite = ROUND_UP(towrite, 4096); + towrite = calc_bitmap_size(bms, 4096); while (towrite > 0) { n = towrite; if (n > 4096) -- 1.7.12.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor