From patchwork Mon May 23 19:54:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 809992 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4NJv0tm024644 for ; Mon, 23 May 2011 19:57:21 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4NJsoUW032000; Mon, 23 May 2011 15:54:51 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4NJsms6022074 for ; Mon, 23 May 2011 15:54:48 -0400 Received: from localhost6.localdomain6 (dhcp80-228.msp.redhat.com [10.15.80.228]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4NJsgov008480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 23 May 2011 15:54:43 -0400 Received: from f14.redhat.com (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4) with ESMTP id p4NJsqax019141 for ; Mon, 23 May 2011 14:54:52 -0500 Received: (from jbrassow@localhost) by f14.redhat.com (8.14.4/8.14.4/Submit) id p4NJspjN019139 for dm-devel@redhat.com; Mon, 23 May 2011 14:54:51 -0500 From: Jonathan Brassow Message-Id: <201105231954.p4NJspjN019139@f14.redhat.com> Date: Mon, 23 May 2011 14:54:51 -0500 To: dm-devel@redhat.com User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH] DM RAID: do not print rebuilds in table line X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 23 May 2011 19:57:21 +0000 (UTC) Patch name: dm-raid-do-not-print-rebuilds-in-table-line.patch DM RAID table status should not include rebuild parameters. When a DM RAID device is constructed, a user may supply a 'rebuild ' pair of parameters to indicate that they want a specific device in the array rebuilt. This action should clear the 'recovery_offset' for the device so that any subsequent reloading of the device will pick up where it left off. The rebuild option is unnecessary and, in fact, unwanted unless it is the intent to begin the rebuild process again. Therefore, we should never include the rebuild parameters when printing the DM table via the status function. Signed-off-by: Jonathan Brassow --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm-raid.c =================================================================== --- linux-2.6.orig/drivers/md/dm-raid.c +++ linux-2.6/drivers/md/dm-raid.c @@ -672,14 +672,11 @@ static int raid_status(struct dm_target break; case STATUSTYPE_TABLE: /* The string you would use to construct this array */ - for (i = 0; i < rs->md.raid_disks; i++) { - if (rs->dev[i].data_dev && - !test_bit(In_sync, &rs->dev[i].rdev.flags)) - raid_param_cnt += 2; /* for rebuilds */ + for (i = 0; i < rs->md.raid_disks; i++) if (rs->dev[i].data_dev && test_bit(WriteMostly, &rs->dev[i].rdev.flags)) raid_param_cnt += 2; - } + raid_param_cnt += (hweight64(rs->print_flags) * 2); if (rs->print_flags & (DMPF_SYNC | DMPF_NOSYNC)) raid_param_cnt--; @@ -692,14 +689,10 @@ static int raid_status(struct dm_target DMEMIT(" sync"); if (rs->print_flags & DMPF_NOSYNC) DMEMIT(" nosync"); - for (i = 0; i < rs->md.raid_disks; i++) { - if (rs->dev[i].data_dev && - !test_bit(In_sync, &rs->dev[i].rdev.flags)) - DMEMIT(" rebuild %u", i); + for (i = 0; i < rs->md.raid_disks; i++) if (rs->dev[i].data_dev && test_bit(WriteMostly, &rs->dev[i].rdev.flags)) DMEMIT(" write_mostly %u", i); - } if (rs->print_flags & DMPF_DAEMON_SLEEP) DMEMIT(" daemon_sleep %lu",