On 09.03.21 16:53, Christoph Hellwig wrote:
Just use the generic anon_inode file system.

Signed-off-by: Christoph Hellwig <h...@lst.de>
---
  arch/powerpc/platforms/pseries/cmm.c | 27 ++-------------------------
  1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/cmm.c 
b/arch/powerpc/platforms/pseries/cmm.c
index 6d36b858b14df1..9d07e6bea7126c 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -6,6 +6,7 @@
   * Author(s): Brian King (brk...@linux.vnet.ibm.com),
   */
+#include <linux/anon_inodes.h>
  #include <linux/ctype.h>
  #include <linux/delay.h>
  #include <linux/errno.h>
@@ -502,19 +503,6 @@ static struct notifier_block cmm_mem_nb = {
  };
#ifdef CONFIG_BALLOON_COMPACTION
-static struct vfsmount *balloon_mnt;
-
-static int cmm_init_fs_context(struct fs_context *fc)
-{
-       return init_pseudo(fc, PPC_CMM_MAGIC) ? 0 : -ENOMEM;
-}
-
-static struct file_system_type balloon_fs = {
-       .name = "ppc-cmm",
-       .init_fs_context = cmm_init_fs_context,
-       .kill_sb = kill_anon_super,
-};
-
  static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
                           struct page *newpage, struct page *page,
                           enum migrate_mode mode)
@@ -573,19 +561,10 @@ static int cmm_balloon_compaction_init(void)
        balloon_devinfo_init(&b_dev_info);
        b_dev_info.migratepage = cmm_migratepage;
- balloon_mnt = kern_mount(&balloon_fs);
-       if (IS_ERR(balloon_mnt)) {
-               rc = PTR_ERR(balloon_mnt);
-               balloon_mnt = NULL;
-               return rc;
-       }
-
-       b_dev_info.inode = alloc_anon_inode_sb(balloon_mnt->mnt_sb);
+       b_dev_info.inode = alloc_anon_inode();
        if (IS_ERR(b_dev_info.inode)) {
                rc = PTR_ERR(b_dev_info.inode);
                b_dev_info.inode = NULL;
-               kern_unmount(balloon_mnt);
-               balloon_mnt = NULL;
                return rc;
        }
@@ -597,8 +576,6 @@ static void cmm_balloon_compaction_deinit(void)
        if (b_dev_info.inode)
                iput(b_dev_info.inode);
        b_dev_info.inode = NULL;
-       kern_unmount(balloon_mnt);
-       balloon_mnt = NULL;
  }
  #else /* CONFIG_BALLOON_COMPACTION */
  static int cmm_balloon_compaction_init(void)


I always wondered why that was necessary after all (with my limited fs knowledge :) ).

a) I assume you want to remove PPC_CMM_MAGIC from include/uapi/linux/magic.h as well?

b) Do we still need #include <linux/magic.h>, #include <linux/mount.h> and #include <linux/pseudo_fs.h>?

Apart from that looks much cleaner.

--
Thanks,

David / dhildenb

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to