From owner-svn-src-projects@FreeBSD.ORG Thu Feb 3 15:13:15 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 7DED0106564A; Thu, 3 Feb 2011 15:13:15 +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 513378FC12; Thu, 3 Feb 2011 15:13:15 +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 p13FDFDT049521; Thu, 3 Feb 2011 15:13:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p13FDF9d049519; Thu, 3 Feb 2011 15:13:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201102031513.p13FDF9d049519@svn.freebsd.org> From: Alexander Motin Date: Thu, 3 Feb 2011 15:13:15 +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: r218224 - 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: Thu, 03 Feb 2011 15:13:15 -0000 Author: mav Date: Thu Feb 3 15:13:15 2011 New Revision: 218224 URL: http://svn.freebsd.org/changeset/base/218224 Log: Handle UNINITIALIZED volume state - report all disks as NEW and let transformation layer choose some for ACTIVE and rebuild the rest. Add some comments. 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 Thu Feb 3 14:42:46 2011 (r218223) +++ projects/graid/head/sys/geom/raid/md_intel.c Thu Feb 3 15:13:15 2011 (r218224) @@ -626,31 +626,43 @@ nofit: mmap1 = mmap0; if (resurrection) { + /* Stale disk, almost same as new. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_NEW); } else if (meta->disk[disk_pos].flags & INTEL_F_FAILED) { + /* Failed disk, almost useless. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_FAILED); } else if (mvol->migr_state == 0) { - if (mmap0->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) { + if (mmap0->status == INTEL_S_UNINITIALIZED) { + /* Freshly created uninitialized volume. */ + g_raid_change_subdisk_state(sd, + G_RAID_SUBDISK_S_NEW); + } else 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 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 (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) { + /* Freshly inserted disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_NEW); } else { + /* Rebuilding disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_REBUILD); sd->sd_rebuild_pos = @@ -661,12 +673,15 @@ nofit: } else if (mvol->migr_type == INTEL_MT_VERIFY || mvol->migr_type == INTEL_MT_REPAIR) { 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) { + /* Freshly inserted disk. */ g_raid_change_subdisk_state(sd, - G_RAID_SUBDISK_S_STALE); + G_RAID_SUBDISK_S_NEW); } else { + /* Resyncing disk. */ g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_RESYNC); sd->sd_rebuild_pos =