Re: [ANNOUNCEMENT PATCH COW] proof of concept impementation of cowlinks

From: Pavel Machek
Date: Mon May 10 2004 - 10:52:25 EST


Hi!

> > Oh, get_cow_inode() should really be allowed to fail in some usefull
> > way, so that filesystems do not have to implement it if its hard for
> > them.
>
> Also correct.
>
> And while we're at it, I need a brain extention again. Pavel? ;)
>
> The real cowlink patch (too ugly to show it yet) is something like
> this:
>
> inode 1: real file
> inode 2: cow->inode 1
> inode 3: cow->inode 1
>
> Stat() on inode 2 is implemented here:
>
> static void cowlink_fillattr(struct inode *link, struct kstat *stat)
> {
> struct super_block *sb = link->i_sb;
> ino_t ino = link->i_op->readcow(link);
> struct inode *inode = iget(sb, ino);
>
> stat->dev = link->i_sb->s_dev;
> stat->ino = ino;
> stat->mode = link->i_mode - S_IFCOW + S_IFREG;
> stat->nlink = link->i_nlink;
> stat->uid = link->i_uid;
> stat->gid = link->i_gid;
> stat->rdev = 0;
> stat->atime = link->i_atime;
> stat->mtime = link->i_mtime;
> stat->ctime = link->i_ctime;
> stat->size = i_size_read(inode);
> stat->blocks = inode->i_blocks;
> stat->blksize = inode->i_blksize;
> }
>
> size, blocks and blksize has to be taken from inode 1, sure. uid,
> gid, mode and *time are from inode 2, also obvious. dev doesn't
> matter yet, but we might do cross-filesystem cowlinks someday. nlink
> should be from inode 2, so several hard links on it work, also agreed.
>
> What about ino? I currently return 1, so diff remains fast without
> any changes. If someone really needs the difference between inode 2
> and 3, I would introduce a cstat() system call similar to lstat(),
> which would return ino=2.

I think you need to return 2, otherwise inode numbers change when
cowling is broken.... and that would be bad.

Aha.. That is another neccessary property for get_cow_inode():
cow_inode can change, any time, unlike normal inode.

Pavel
--
Horseback riding is like software...
...vgf orggre jura vgf serr.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/