On Mon, Jun 12, 2023 at 09:37:51AM +0300, Amir Goldstein wrote: > On Mon, Jun 12, 2023 at 7:45 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > > > > On Sun, Jun 11, 2023 at 10:47:05PM +0300, Amir Goldstein wrote: > > > Overlayfs and cachefiles use open_with_fake_path() to allocate internal > > > files, where overlayfs also puts a "fake" path in f_path - a path which > > > is not on the same fs as f_inode. > > > > But cachefs doesn't, so this needs a better explanation / documentation. > > > > > Allocate a container struct file_fake for those internal files, that > > > is used to hold the fake path along with an optional real path. > > > > The idea looks sensible, but fake a is a really weird term here. > > I know open_with_fake_path also uses it, but we really need to > > come up with a better name, and also good documentation of the > > concept here. > > > > > +/* Returns the real_path field that could be empty */ > > > +struct path *__f_real_path(struct file *f) > > > +{ > > > + struct file_fake *ff = file_fake(f); > > > + > > > + if (f->f_mode & FMODE_FAKE_PATH) > > > + return &ff->real_path; > > > + else > > > + return &f->f_path; > > > +} > > > > two of the three callers always have FMODE_FAKE_PATH set, so please > > just drop this helper and open code it in the three callers. > > > > I wanted to keep the container opaque This is preferable to me tbh to not leak this detail into callsites.