xfs
[Top] [All Lists]

Re: beginners project: RENAME_WHITEOUT

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: beginners project: RENAME_WHITEOUT
From: Miklos Szeredi <miklos@xxxxxxxxxx>
Date: Mon, 10 Nov 2014 10:25:40 +0100
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iVwRrzlDcisC8YbUH5n3DwR9lAqLlnWhYil1iE34rmU=; b=i10s/vO+Io7mwUnj1Yvhu141nF1H4YdKunkuDxb5XoYfACc/+E/6CkYyiKU6w4jil7 s4lynTS7vgj9UG/xYjBmtXTTQDfOoR8qIWwfNrrXgziJGskBcrEtPTJKs0nKsAZyI+PP 6j+dhi5XdnoSiDJBv+4kipnru6WzUefIu1kLY=
In-reply-to: <20141108234232.GJ28565@dastard>
References: <20141107190959.GB21021@xxxxxxxxxxxxx> <20141108234232.GJ28565@dastard>
On Sun, Nov 9, 2014 at 12:42 AM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
> On Fri, Nov 07, 2014 at 11:09:59AM -0800, Christoph Hellwig wrote:
>> The overlayfs merge introduces a new rename flag to create to whiteouts.
>> Should be a fairly easy to implement.
>>
>> Miklos, do you have any good documentation and/or test cases for this?
>
> So overlayfs uses some weird char dev hack to implement whiteout
> inodes in directories?  Why do we need a whiteout inode on disk?
> what information is actually stored in the whiteout inode that
> overlayfs actually needs?  Only readdir and lookup care about
> whiteouts, and AFAICT nothing of the inode is ever used except
> checking the chrdev/whiteoutdev hack via ovl_is_whiteout(dentry).
>
> Indeed, whatever happened to just storing the whiteout in the dirent
> via DT_WHT and using that information on lookup in the lower
> filesystem to mark the dentry returned appropriately without needing
> to lookup a real inode?

The filesystem is free to implement whiteouts a dirent without an actual inode.

But we do need at least an inode in the VFS, since the whiteout needs
to be presented to userspace when not part of the overlay.  The DT_WHT
makes the typical mistake of trying to make the implementation nice,
while not caring about user interfaces.

This is usually a big mistake, user interfaces are much more important
than implementation details, and an already existing file type on
which all the usual operations work (stat, unlink) is much better in
this respect than a completely new object which is unknown and
unmanageable for the vast majority of applications.

The special chardev was Linus' idea, but I agree with him completely
on this point.  Introducing DT_WHT on the userspace API would be much
more of a hack than reusing existing objects and operations.

Thanks,
Miklos

<Prev in Thread] Current Thread [Next in Thread>