Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752038AbdDAVvY (ORCPT ); Sat, 1 Apr 2017 17:51:24 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36135 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751933AbdDAVvW (ORCPT ); Sat, 1 Apr 2017 17:51:22 -0400 X-ME-Sender: X-Sasl-enc: 9CjI7cjyenfUGZGWRuIDU/yth8Q1N5bWimvJ5ALStyEN 1491083481 Date: Sat, 1 Apr 2017 18:51:18 -0300 From: Henrique de Moraes Holschuh To: Wols Lists Cc: Ming Lei , Arnd Bergmann , Shaohua Li , NeilBrown , Jens Axboe , "colyli@suse.de" , Guoqing Jiang , Mike Christie , "open list:SOFTWARE RAID (Multiple Disks) SUPPORT" , Linux Kernel Mailing List Subject: Re: [PATCH] Revert "md: raid1: use bio helper in process_checks()" Message-ID: <20170401215118.GB31653@khazad-dum.debian.net> References: <20170328095029.3500369-1-arnd@arndb.de> <58DA848B.7030308@youngman.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58DA848B.7030308@youngman.org.uk> X-GPG-Fingerprint1: 4096R/0x0BD9E81139CB4807: C467 A717 507B BAFE D3C1 6092 0BD9 E811 39CB 4807 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 809 Lines: 19 On Tue, 28 Mar 2017, Wols Lists wrote: > What Arnd is doing is commonly called "defensive programming", and > unfortunately reality shows us that it is usually worth its weight in > gold. That's why you put ASSERTs in code - so that if somebody does > something stupid by accident, it blows up. This is just more of the same. You know, BUG_ON(vcnt1 != vcnt2) might address this quite nicely [if you want to go the assert() way, that is!], since __attribute__((noreturn)) is set for the codepath taken when the BUG_ON condition triggers... That said, if there is something less insane to be done than OOPsing when the world has gone strange and vcnt1 != vcnt2, that ought to be a better solution... All of this assumes vcnt1 == vcnt2 is really the only possibily correct situation. -- Henrique Holschuh