From owner-svn-src-projects@FreeBSD.ORG Fri Feb 4 03:30:29 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 388C41065673; Fri, 4 Feb 2011 03:30:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2E3E8FC08; Fri, 4 Feb 2011 03:30:28 +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 p143USj7067953; Fri, 4 Feb 2011 03:30:28 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p143US4T067951; Fri, 4 Feb 2011 03:30:28 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201102040330.p143US4T067951@svn.freebsd.org> From: Warner Losh Date: Fri, 4 Feb 2011 03:30:28 +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: r218250 - 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: Fri, 04 Feb 2011 03:30:29 -0000 Author: imp Date: Fri Feb 4 03:30:28 2011 New Revision: 218250 URL: http://svn.freebsd.org/changeset/base/218250 Log: move from #define to static variables for tunables Modified: projects/graid/head/sys/geom/raid/tr_raid1.c Modified: projects/graid/head/sys/geom/raid/tr_raid1.c ============================================================================== --- projects/graid/head/sys/geom/raid/tr_raid1.c Fri Feb 4 03:18:51 2011 (r218249) +++ projects/graid/head/sys/geom/raid/tr_raid1.c Fri Feb 4 03:30:28 2011 (r218250) @@ -41,11 +41,15 @@ __FBSDID("$FreeBSD$"); #include "g_raid_tr_if.h" #define SD_READ_THRESHOLD 10 /* errors to cause a rebuild */ +static int sd_read_threshold = SD_READ_THRESHOLD; #define SD_REBUILD_SLAB (1 << 20) /* One transation in a rebuild */ +static int sd_rebuild_slab = SD_REBUILD_SLAB; #define SD_REBUILD_FAIR_IO 20 /* use 1/x of the available I/O */ -#define SD_REBUILD_CLUSTER_BUSY 4 +static int sd_rebuild_fair_io = SD_REBUILD_FAIR_IO; #define SD_REBUILD_CLUSTER_IDLE 10 +static int sd_rebuild_cluster_idle = SD_REBUILD_CLUSTER_IDLE; #define SD_REBUILD_META_UPDATE 500 /* update meta data every 5 GB or so */ +static int sd_rebuild_meta_update = SD_REBUILD_META_UPDATE; static MALLOC_DEFINE(M_TR_raid1, "tr_raid1_data", "GEOM_RAID raid1 data"); @@ -174,7 +178,7 @@ g_raid_tr_raid1_rebuild_some(struct g_ra bp = &trs->trso_bio; memset(bp, 0, sizeof(*bp)); bp->bio_offset = sd->sd_rebuild_pos; - bp->bio_length = MIN(SD_REBUILD_SLAB, + bp->bio_length = MIN(sd_rebuild_slab, sd->sd_volume->v_mediasize - sd->sd_rebuild_pos); bp->bio_data = trs->trso_buffer; bp->bio_cmd = BIO_READ; @@ -183,8 +187,8 @@ g_raid_tr_raid1_rebuild_some(struct g_ra return; bp2->bio_cflags = G_RAID_BIO_FLAG_SYNC; bp2->bio_caller1 = good_sd; - trs->trso_recover_slabs = SD_REBUILD_CLUSTER_IDLE; - trs->trso_fair_io = SD_REBUILD_FAIR_IO; + trs->trso_recover_slabs = sd_rebuild_cluster_idle; + trs->trso_fair_io = sd_rebuild_fair_io; trs->trso_flags |= TR_RAID1_F_DOING_SOME; g_raid_lock_range(sd->sd_volume, /* Lock callback starts I/O */ bp2->bio_offset, bp2->bio_length, bp2); @@ -222,7 +226,7 @@ g_raid_tr_raid1_rebuild_abort(struct g_r trs = (struct g_raid_tr_raid1_object *)tr; sd = trs->trso_failed_sd; // sd->sd_rebuild_pos = 0; /* We may need this here... */ - len = MIN(SD_REBUILD_SLAB, vol->v_mediasize - sd->sd_rebuild_pos); + len = MIN(sd_rebuild_slab, vol->v_mediasize - sd->sd_rebuild_pos); g_raid_unlock_range(tr->tro_volume, sd->sd_rebuild_pos, len); g_raid_write_metadata(vol->v_softc, vol, sd, sd->sd_disk); free(trs->trso_buffer, M_TR_raid1); @@ -278,8 +282,8 @@ g_raid_tr_raid1_rebuild_start(struct g_r G_RAID_DEBUG(2, "Kicking off a rebuild at %jd...", trs->trso_failed_sd->sd_rebuild_pos); trs->trso_type = TR_RAID1_REBUILD; - trs->trso_buffer = malloc(SD_REBUILD_SLAB, M_TR_raid1, M_WAITOK); - trs->trso_meta_update = SD_REBUILD_META_UPDATE; + trs->trso_buffer = malloc(sd_rebuild_slab, M_TR_raid1, M_WAITOK); + trs->trso_meta_update = sd_rebuild_meta_update; g_raid_tr_raid1_rebuild_some(tr, trs->trso_failed_sd); } @@ -592,11 +596,7 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ * The write operation just finished. Do * another. We keep cloning the master bio * since it has the right buffers allocated to - * it. We'll free it when slabs get to 0. - * We'll also tie up SD_REBUILD_CLUSTER * 2 + - * 1 bios from the pool. Since - * SD_REBUILD_CLUSTER should be small, that - * shouldn't be a problem. + * it. */ G_RAID_LOGREQ(4, bp, "rebuild write done. Error %d", bp->bio_error); @@ -619,7 +619,8 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ if (--trs->trso_meta_update <= 0) { g_raid_write_metadata(vol->v_softc, vol, nsd, nsd->sd_disk); - trs->trso_meta_update = SD_REBUILD_META_UPDATE; + trs->trso_meta_update = + sd_rebuild_meta_update; } trs->trso_flags &= ~TR_RAID1_F_DOING_SOME; return; @@ -645,7 +646,7 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ cbp->bio_cmd = BIO_READ; cbp->bio_cflags = G_RAID_BIO_FLAG_SYNC; cbp->bio_offset = nsd->sd_rebuild_pos; - cbp->bio_length = MIN(SD_REBUILD_SLAB, + cbp->bio_length = MIN(sd_rebuild_slab, vol->v_mediasize - nsd->sd_rebuild_pos); cbp->bio_caller1 = good_sd; G_RAID_LOGREQ(4, bp, @@ -683,7 +684,7 @@ g_raid_tr_iodone_raid1(struct g_raid_tr_ * everything to get it back in sync), or just degrade the * drive, which kicks off a resync? */ - if (sd->sd_read_errs > SD_READ_THRESHOLD) + if (sd->sd_read_errs > sd_read_threshold) g_raid_fail_disk(sd->sd_softc, sd, sd->sd_disk); /*