Patch?: linux-2.5.33/drivers/block/loop.c update

From: Adam J. Richter (adam@yggdrasil.com)
Date: Fri Sep 06 2002 - 10:45:58 EST


        The followingp patch is the latest version of my loop.c
updates.

        This version makes device backed loop devices work even
when the bio_alloc in the IO path returns NULL (i.e., under
memory pressure). When a loop device is configured, a page
(or q->hardsect_size if that is bigger) is preallocated for
use in case of memory allocation failure. If memory allocation
failure occurs in the IO path, the bio is submitted using this
reservd area, one page at a time. The advantage of this approach
is that is possible to allow bio producers to submit very big
transfers without needing to reserve so much memory for backup.

        Because /dev/loop now can handle the memory allocation
failures, I have changed the memory allocation in the IO path
to be non-blocking.

        I have tested this with the bio allocation code changed
to always fail. I tested the following cases:

                                plain encrypted
                device X
                file on ext2 X X
                file on tmpfs X X

        I have not yet tested it on an encrypted device because
Linux 2.5.32 and .33 cause the computers' keyboard not work on
every machine that I've tried them on, and the arrangement that
I use for testing an encrypted device requires me to enter a
password on a keyboard before networking has come up. I may
fiddling with setting up anotehr way to test that case, although
I'd rather devote that energy to tracking down the keyboard
problem.

        The other new changes are basically just clean ups.

        There are now separate q->make_request_fn and
loop_handler functions for file-backed and device-backed
cases. Besides pulling somre branches and subroutine calls
out of the IO path, this also makes it easier to read.

        The variables that were previously named "bio" have been
renamed to "loop_bio" if they are used only as a bio for /dev/loop/nnn,
or "dev_bio" when they are used only as a bio for the underlying
hardware device that the loop is mounted on. In the few cases
where a bio variable could be used either way under different
circumstances, its name remains "bio". I think this makes the
code much easier to undertstand and maintain.

-- 
Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."


- 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/



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:29 EST