Re: [dm-devel] [RFC, PATCH] remove signal handling from dm-io.c, sync_io()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 11 June 2004 7:01 pm, Alasdair G Kergon wrote:
> On Thu, Jun 10, 2004 at 05:30:31PM +0000, Kevin Corry wrote:
> > And while we're in there hacking up that routine, we should probably add
> > proper error handling instead of just using BUG_ON() in the event someone
> > tries to read from multiple regions.
>
> At present, the num_regions parameter is not allowed to exceed 1 when
> reading. If it does, that should show up clearly as a coding error.
> Prefer WARN_ON() ?

In general I'm not a big fan of BUG() statements, and I try to only use them 
to indicate some unexpected error internal to a driver. In the current 
context of dm-io only being used by DM modules that we write, I might agree 
that the BUG_ON() is sufficient. But I really see dm-io as something that 
should eventually become a generic block-layer service, not specific to just 
DM. In that event, potentially any driver could be calling the routines, and 
as such it makes sense to me to validate the arguments to prevent invalid 
uses. In that context, a BUG_ON() seems heavy-handed. A WARN_ON() by itself 
seems insufficient since it will let the routine keep executing, which we 
obviously don't want. However, it might be worth adding an error message and 
stack-dump (like you get with WARN_ON) in that situation in addition to 
returning an error.

-- 
Kevin Corry
kevcorry@xxxxxxxxxx
http://evms.sourceforge.net/

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux