Re: Linux 2.4.10-pre11

Linus Torvalds (torvalds@transmeta.com)
Tue, 18 Sep 2001 10:02:55 -0700 (PDT)


On Tue, 18 Sep 2001, Andrea Arcangeli wrote:
> >
> > What are you going to use as mapping->host for it?
>
> the only info we'd need from the host is the host->i_rdev, so why can't
> we get it from the file->f_dentry->d_inode->i_rdev?

No, just allocate a real inode as part of "struct block_device"
allocation. This is basically what socket etc stuff does - and it's
actually easiest to do it the other way, exactly like sockets do (ie
_embed_ "struct block_device" inside a struct inode as if "block_device"
was just another filesystem), and then just allocate one inode and get the
"struct block_device" allocation for free.

This works really well for sockets, and has worked for a long time. See
how the socket is hidden in "inode->u.socket_i", and how it's trivial to
convert from one to the other.

And the fact is, a block_device _is_ a simple filesystem if you squint
just the right way. Admittedly it's a fairly flat and _boring_ filesystem,
but hey, that's the point of them, after all ;)

Linus

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