From owner-svn-src-projects@FreeBSD.ORG Sun Feb 13 18:08:54 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C860106566C; Sun, 13 Feb 2011 18:08:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 415CA8FC13; Sun, 13 Feb 2011 18:08:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1DI8saS046675; Sun, 13 Feb 2011 18:08:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1DI8smT046673; Sun, 13 Feb 2011 18:08:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201102131808.p1DI8smT046673@svn.freebsd.org> From: Alexander Motin Date: Sun, 13 Feb 2011 18:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218649 - projects/graid/head/sys/geom/raid X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2011 18:08:54 -0000 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,