From patchwork Mon Jun 1 22:39:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Yao X-Patchwork-Id: 479217 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 085A91402D5 for ; Tue, 2 Jun 2015 08:40:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752956AbbFAWjk (ORCPT ); Mon, 1 Jun 2015 18:39:40 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:58819 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbbFAWjj (ORCPT ); Mon, 1 Jun 2015 18:39:39 -0400 Received: from localhost.localdomain (pool-72-89-250-199.nycmny.fios.verizon.net [72.89.250.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ryao) by smtp.gentoo.org (Postfix) with ESMTPSA id 8782A340E26; Mon, 1 Jun 2015 22:39:38 +0000 (UTC) From: Richard Yao To: linux-ext4@vger.kernel.org Cc: Theodore Ts'o , Richard Yao Subject: [PATCH] e2fsprogs: misc: Remove broken whole device check Date: Mon, 1 Jun 2015 18:39:22 -0400 Message-Id: <1433198362-86983-1-git-send-email-ryao@gentoo.org> X-Mailer: git-send-email 2.3.6 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Richard Yao Modern Linux major/minor numbering on block devices no longer conform to the divisible by 64 rule for minor numbering. On my development system, the correct number is 16. Consequently, this applies only to every 4th drive on a modern system, which is inconsistent. That caused the following bug to be filed against Flocker: https://clusterhq.atlassian.net/browse/FLOC-2041 We could unconditionally pass -F to override this check whenever it triggers, but that it would also override the libblkid check that determines whether there are existing partitions, logical volumes or filesystems on the disk, which seems unwise. I propose that this check be removed because passing a whole disk to mke2fs is a valid use case and given how long this has been broken, users are already accustomed to the behavior where -F is not necessary to format a whole disk as ext4. Signed-off-by: Richard Yao Reviewed-by: Andreas Dilger --- misc/plausible.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/misc/plausible.c b/misc/plausible.c index 1848a26..97492b9 100644 --- a/misc/plausible.c +++ b/misc/plausible.c @@ -18,9 +18,6 @@ #include "config.h" #include #include -#ifdef HAVE_LINUX_MAJOR_H -#include -#endif #include #ifdef HAVE_SYS_STAT_H #include @@ -265,35 +262,6 @@ int check_plausibility(const char *device, int flags, int *ret_is_dev) if (ret >= 0) return ret; -#ifdef HAVE_LINUX_MAJOR_H -#ifndef MAJOR -#define MAJOR(dev) ((dev)>>8) -#define MINOR(dev) ((dev) & 0xff) -#endif -#ifndef SCSI_BLK_MAJOR -#ifdef SCSI_DISK0_MAJOR -#ifdef SCSI_DISK8_MAJOR -#define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \ - ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR) || \ - ((M) >= SCSI_DISK8_MAJOR && (M) <= SCSI_DISK15_MAJOR)) -#else -#define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \ - ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR)) -#endif /* defined(SCSI_DISK8_MAJOR) */ -#define SCSI_BLK_MAJOR(M) (SCSI_DISK_MAJOR((M)) || (M) == SCSI_CDROM_MAJOR) -#else -#define SCSI_BLK_MAJOR(M) ((M) == SCSI_DISK_MAJOR || (M) == SCSI_CDROM_MAJOR) -#endif /* defined(SCSI_DISK0_MAJOR) */ -#endif /* defined(SCSI_BLK_MAJOR) */ - if (((MAJOR(s.st_rdev) == HD_MAJOR && - MINOR(s.st_rdev)%64 == 0) || - (SCSI_BLK_MAJOR(MAJOR(s.st_rdev)) && - MINOR(s.st_rdev)%16 == 0))) { - printf(_("%s is entire device, not just one partition!\n"), - device); - return 0; - } -#endif return 1; }