From 05c0f9246182dcfc09b92218170cd4316e2dd0d8 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Tue, 17 Jan 2012 01:28:07 +0000 Subject: Avoid ffs fragsize < sector-size when 'a'dding a partition via the editor. Use logic from calculating fragsize for an auto-allocated partition. Noted when trying to add a small ffs partition to a 4K sector device. --- sbin/disklabel/editor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sbin/disklabel') diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index dcd734c47c7..f2c3b0d991c 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.262 2012/01/02 03:46:39 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.263 2012/01/17 01:28:06 krw Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller @@ -891,7 +891,8 @@ editor_add(struct disklabel *lp, char *p) if (get_offset(lp, partno) == 0 && get_size(lp, partno) == 0) { - fragsize = 2048; + fragsize = (lp->d_secsize == DEV_BSIZE) ? 2048 : + lp->d_secsize; new_size = DL_GETPSIZE(pp) * lp->d_secsize; if (new_size > 128ULL * 1024 * 1024 * 1024) fragsize *= 2; -- cgit v1.2.3