Message ID | 1436776519-17337-2-git-send-email-gioh.kim@lge.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jul 13, 2015 at 05:35:16PM +0900, Gioh Kim wrote: > From: Gioh Kim <gurugio@hanmail.net> > > The anon_inodes has already complete interfaces to create manage > many anonymous inodes but don't have interface to get > new inode. Other sub-modules can create anonymous inode > without creating and mounting it's own pseudo filesystem. > > Signed-off-by: Gioh Kim <gioh.kim@lge.com> > Acked-by: Rafael Aquini <aquini@redhat.com> This is my first run through the series so I'm going to miss details but this patch confuses me a little. You create an inode to associate with the balloon dev_info so that page->mapping can be assigned. It's only the mapping you care about for the aops so why are multiple inodes required? A driver should be able to share and reference count a single inode. The motivation to do it that way would be to reduce memory consumption and this series is motivated by embedded platforms. anon_inode_getfd has the following * Creates a new file by hooking it on a single inode. This is useful for files * that do not need to have a full-fledged inode in order to operate correctly. * All the files created with anon_inode_getfd() will share a single inode, * hence saving memory and avoiding code duplication for the file/inode/dentry * setup. Returns new descriptor or an error code. If all we care about the inode is the aops then it would follow that anon_inode_getfd() is ideal. The tradeoff is reference counting overhead. The changelog needs to explain why anon_inode_getfd() cannot be used.
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 80ef38c..1d51f96 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c @@ -162,6 +162,12 @@ err_put_unused_fd: } EXPORT_SYMBOL_GPL(anon_inode_getfd); +struct inode *anon_inode_new(void) +{ + return alloc_anon_inode(anon_inode_mnt->mnt_sb); +} +EXPORT_SYMBOL_GPL(anon_inode_new); + static int __init anon_inode_init(void) { anon_inode_mnt = kern_mount(&anon_inode_fs_type); diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h index 8013a45..ddbd67f 100644 --- a/include/linux/anon_inodes.h +++ b/include/linux/anon_inodes.h @@ -15,6 +15,7 @@ struct file *anon_inode_getfile(const char *name, void *priv, int flags); int anon_inode_getfd(const char *name, const struct file_operations *fops, void *priv, int flags); +struct inode *anon_inode_new(void); #endif /* _LINUX_ANON_INODES_H */