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 assume_clean
) { ) {
info.array.state = 1; /* clean, but one+ drive will be missing*/ info.array.state = 1; /* clean, but one+ drive will be missing*/
info.resync_start = ~0ULL; info.resync_start = MaxSector;
} else { } else {
info.array.state = 0; /* not clean, but no errors */ info.array.state = 0; /* not clean, but no errors */
info.resync_start = 0; info.resync_start = 0;

View File

@ -149,6 +149,7 @@ struct mdinfo {
union { union {
unsigned long long resync_start; /* per-array resync position */ unsigned long long resync_start; /* per-array resync position */
unsigned long long recovery_start; /* per-device rebuild 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 */ unsigned long safe_mode_delay; /* ms delay to mark clean */
int new_level, delta_disks, new_layout, new_chunk; 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) if (n <= 0)
return 0; return 0;
if (strncmp(buf, "none", 4) == 0) if (strncmp(buf, "none", 4) == 0)
return ~0ULL; return MaxSector;
else else
return strtoull(buf, NULL, 10); 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->virt->entries[info->container_member].init_state
& DDF_initstate_mask) & DDF_initstate_mask)
== DDF_init_full) == DDF_init_full)
info->resync_start = ~0ULL; info->resync_start = MaxSector;
uuid_from_super_ddf(st, info->uuid); uuid_from_super_ddf(st, info->uuid);
@ -2921,7 +2921,7 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
this->resync_start = 0; this->resync_start = 0;
} else { } else {
this->array.state = 1; this->array.state = 1;
this->resync_start = ~0ULL; this->resync_start = MaxSector;
} }
memcpy(this->name, ddf->virt->entries[i].name, 16); memcpy(this->name, ddf->virt->entries[i].name, 16);
this->name[16]=0; 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 */ /* FIXME add curr_migr_unit to resync_start conversion */
info->resync_start = 0; info->resync_start = 0;
else else
info->resync_start = ~0ULL; info->resync_start = MaxSector;
strncpy(info->name, (char *) dev->volume, MAX_RAID_SERIAL_LEN); strncpy(info->name, (char *) dev->volume, MAX_RAID_SERIAL_LEN);
info->name[MAX_RAID_SERIAL_LEN] = 0; info->name[MAX_RAID_SERIAL_LEN] = 0;
@ -3482,7 +3482,7 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
* offset * offset
*/ */
unsigned long long minsize = size; unsigned long long minsize = size;
unsigned long long start_offset = ~0ULL; unsigned long long start_offset = MaxSector;
int dcnt = 0; int dcnt = 0;
if (minsize == 0) if (minsize == 0)
minsize = MPB_SECTOR_CNT + IMSM_RESERVED_SECTORS; 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; esize = e[i].start - pos;
if (esize >= minsize) if (esize >= minsize)
found = 1; found = 1;
if (found && start_offset == ~0ULL) { if (found && start_offset == MaxSector) {
start_offset = pos; start_offset = pos;
break; break;
} else if (found && pos != start_offset) { } else if (found && pos != start_offset) {
@ -3856,7 +3856,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st)
* FIXME handle dirty degraded * FIXME handle dirty degraded
*/ */
if (skip && !dev->vol.dirty) if (skip && !dev->vol.dirty)
this->resync_start = ~0ULL; this->resync_start = MaxSector;
if (skip) if (skip)
continue; continue;

View File

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