Date: Sun, 13 Feb 2011 18:08:54 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r218649 - projects/graid/head/sys/geom/raid Message-ID: <201102131808.p1DI8smT046673@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sun Feb 13 18:08:53 2011 New Revision: 218649 URL: http://svn.freebsd.org/changeset/base/218649 Log: Change dirty flag handling during rebuild and resync. Do not report disks as ACTIVE in those cases. It is not important for two-disk arrays, because transformation modules will any way shift one to ACTIVE. But 3+ disk arrays may get real use of it. Modified: projects/graid/head/sys/geom/raid/md_intel.c Modified: projects/graid/head/sys/geom/raid/md_intel.c ============================================================================== --- projects/graid/head/sys/geom/raid/md_intel.c Sun Feb 13 18:03:30 2011 (r218648) +++ projects/graid/head/sys/geom/raid/md_intel.c Sun Feb 13 18:08:53 2011 (r218649) @@ -776,15 +776,11 @@ nofit: } } else if (mvol->migr_type == INTEL_MT_INIT || mvol->migr_type == INTEL_MT_REBUILD) { - if (!(mmap1->disk_idx[sd->sd_pos] & INTEL_DI_RBLD)) { - /* Up to date disk. */ - g_raid_change_subdisk_state(sd, - G_RAID_SUBDISK_S_ACTIVE); - } else if (mmap0->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) { + if (mmap0->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) { /* Freshly inserted disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_NEW); - } else { + } else if (mmap1->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) { /* Rebuilding disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_REBUILD); @@ -796,18 +792,22 @@ nofit: sd->sd_volume->v_strip_size * mmap0->total_domains; } - } - } else if (mvol->migr_type == INTEL_MT_VERIFY || - mvol->migr_type == INTEL_MT_REPAIR) { - if (!(mmap1->disk_idx[sd->sd_pos] & INTEL_DI_RBLD)) { + } else if (mvol->dirty) { + /* Dirty volume (unclean shutdown). */ + g_raid_change_subdisk_state(sd, + G_RAID_SUBDISK_S_STALE); + } else { /* Up to date disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_ACTIVE); - } else if (mmap0->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) { + } + } else if (mvol->migr_type == INTEL_MT_VERIFY || + mvol->migr_type == INTEL_MT_REPAIR) { + if (mmap0->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) { /* Freshly inserted disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_NEW); - } else { + } else if (mmap1->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) { /* Resyncing disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_RESYNC); @@ -819,6 +819,14 @@ nofit: sd->sd_volume->v_strip_size * mmap0->total_domains; } + } else if (mvol->dirty) { + /* Dirty volume (unclean shutdown). */ + g_raid_change_subdisk_state(sd, + G_RAID_SUBDISK_S_STALE); + } else { + /* Up to date disk. */ + g_raid_change_subdisk_state(sd, + G_RAID_SUBDISK_S_ACTIVE); } } g_raid_event_send(sd, G_RAID_SUBDISK_E_NEW,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102131808.p1DI8smT046673>