Introduce MaxSector

Replace occurrences of ~0ULL to make it clear we are talking about maximal
resync/recovery position.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2009-12-21 10:23:26 -07:00
parent e1516be1db
commit b7528a20cc
6 changed files with 12 additions and 11 deletions

View File

@ -527,7 +527,7 @@ int Create(struct supertype *st, char *mddev,
assume_clean
) {
info.array.state = 1; /* clean, but one+ drive will be missing*/
info.resync_start = ~0ULL;
info.resync_start = MaxSector;
} else {
info.array.state = 0; /* not clean, but no errors */
info.resync_start = 0;

View File

@ -149,6 +149,7 @@ struct mdinfo {
union {
unsigned long long resync_start; /* per-array resync position */
unsigned long long recovery_start; /* per-device rebuild position */
#define MaxSector (~0ULL) /* resync/recovery complete position */
};
unsigned long safe_mode_delay; /* ms delay to mark clean */
int new_level, delta_disks, new_layout, new_chunk;

View File

@ -75,7 +75,7 @@ static unsigned long long read_resync_start(int fd)
if (n <= 0)
return 0;
if (strncmp(buf, "none", 4) == 0)
return ~0ULL;
return MaxSector;
else
return strtoull(buf, NULL, 10);
}

View File

@ -1433,7 +1433,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
(ddf->virt->entries[info->container_member].init_state
& DDF_initstate_mask)
== DDF_init_full)
info->resync_start = ~0ULL;
info->resync_start = MaxSector;
uuid_from_super_ddf(st, info->uuid);
@ -2921,7 +2921,7 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
this->resync_start = 0;
} else {
this->array.state = 1;
this->resync_start = ~0ULL;
this->resync_start = MaxSector;
}
memcpy(this->name, ddf->virt->entries[i].name, 16);
this->name[16]=0;

View File

@ -1271,7 +1271,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info)
/* FIXME add curr_migr_unit to resync_start conversion */
info->resync_start = 0;
else
info->resync_start = ~0ULL;
info->resync_start = MaxSector;
strncpy(info->name, (char *) dev->volume, MAX_RAID_SERIAL_LEN);
info->name[MAX_RAID_SERIAL_LEN] = 0;
@ -3482,7 +3482,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
* offset
*/
unsigned long long minsize = size;
unsigned long long start_offset = ~0ULL;
unsigned long long start_offset = MaxSector;
int dcnt = 0;
if (minsize == 0)
minsize = MPB_SECTOR_CNT + IMSM_RESERVED_SECTORS;
@ -3498,7 +3498,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
esize = e[i].start - pos;
if (esize >= minsize)
found = 1;
if (found && start_offset == ~0ULL) {
if (found && start_offset == MaxSector) {
start_offset = pos;
break;
} else if (found && pos != start_offset) {
@ -3856,7 +3856,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
* FIXME handle dirty degraded
*/
if (skip && !dev->vol.dirty)
this->resync_start = ~0ULL;
this->resync_start = MaxSector;
if (skip)
continue;

View File

@ -659,9 +659,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
switch(__le32_to_cpu(sb->level)) {
case 5: case 4: case 6:
/* need to force clean */
if (sb->resync_offset != ~0ULL)
if (sb->resync_offset != MaxSector)
rv = 1;
sb->resync_offset = ~0ULL;
sb->resync_offset = MaxSector;
}
}
if (strcmp(update, "assemble")==0) {
@ -855,7 +855,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
sb->utime = sb->ctime;
sb->events = __cpu_to_le64(1);
if (info->state & (1<<MD_SB_CLEAN))
sb->resync_offset = ~0ULL;
sb->resync_offset = MaxSector;
else
sb->resync_offset = 0;
sb->max_dev = __cpu_to_le32((1024- sizeof(struct mdp_superblock_1))/