lkml.org 
[lkml]   [2007]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] [bugfix] loop.c
On Fri, Mar 23, 2007 at 03:48:09PM +0100, Eric Dumazet wrote:
> On Fri, 23 Mar 2007 14:36:05 +0000
> Al Viro <viro@ftp.linux.org.uk> wrote:
>
> > On Fri, Mar 23, 2007 at 03:19:56PM +0100, Eric Dumazet wrote:
> > > I cooked the following patch (untested), feel free to test it.
> >
> > Please, get the cleanup into saner shape. This is too ugly.
>
> out_mem:
> while (nba--)
> blk_cleanup_queue(loop_dev[nba]->lo_queue);
> while (nbl--) {
> put_disk(loop_dev[nbl]->lo_disk);
> kfree(loop_dev[nbl]);
> }
> if (loop_dev_vmalloced)
> vfree(loop_dev);
> else
> kfree(loop_dev);
> unregister_blkdev(LOOP_MAJOR, "loop");
>
>
> What is ugly in this code ?

Your counters. Two loops instead of one (no reason to allocate queues in
a a separate loop). vmalloc conditional on kmalloc failure.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-23 17:49    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site