Bitmap_offset is a signed number

As the bitmap can be before the superblock, bitmap_offset is signed.
But some of the code didn't honour that :-(

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2012-04-04 14:00:42 +10:00
parent 15632a96f4
commit fbdef49811
3 changed files with 4 additions and 4 deletions

View File

@ -211,7 +211,7 @@ struct mdinfo {
unsigned long long recovery_start; /* per-device rebuild position */
#define MaxSector (~0ULL) /* resync/recovery complete position */
};
unsigned long bitmap_offset; /* 0 == none, 1 == a file */
long bitmap_offset; /* 0 == none, 1 == a file */
unsigned long safe_mode_delay; /* ms delay to mark clean */
int new_level, delta_disks, new_layout, new_chunk;
int errors;

View File

@ -620,7 +620,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
info->data_offset = __le64_to_cpu(sb->data_offset);
info->component_size = __le64_to_cpu(sb->size);
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_BITMAP_OFFSET))
info->bitmap_offset = __le32_to_cpu(sb->bitmap_offset);
info->bitmap_offset = (long)__le32_to_cpu(sb->bitmap_offset);
info->disk.major = 0;
info->disk.minor = 0;
@ -1636,7 +1636,7 @@ add_internal_bitmap1(struct supertype *st,
offset = -room;
}
sb->bitmap_offset = __cpu_to_le32(offset);
sb->bitmap_offset = (long)__cpu_to_le32(offset);
sb->feature_map = __cpu_to_le32(__le32_to_cpu(sb->feature_map)
| MD_FEATURE_BITMAP_OFFSET);

View File

@ -226,7 +226,7 @@ struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options)
else if (strncmp(buf, "none", 4) == 0)
sra->bitmap_offset = 0;
else if (buf[0] == '+')
sra->bitmap_offset = strtoul(buf+1, NULL, 10);
sra->bitmap_offset = strtol(buf+1, NULL, 10);
else
goto abort;
}