[PATCH 6/9] virtio_balloon: remove the balloon-kvm file system

David Hildenbrand david at redhat.com
Wed Mar 10 03:29:01 AEDT 2021


On 09.03.21 16:53, Christoph Hellwig wrote:
> Just use the generic anon_inode file system.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>   drivers/virtio/virtio_balloon.c | 30 +++---------------------------
>   1 file changed, 3 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index cae76ee5bdd688..1efb890cd3ff09 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -6,6 +6,7 @@
>    *  Copyright 2008 Rusty Russell IBM Corporation
>    */
>   
> +#include <linux/anon_inodes.h>
>   #include <linux/virtio.h>
>   #include <linux/virtio_balloon.h>
>   #include <linux/swap.h>
> @@ -42,10 +43,6 @@
>   	(1 << (VIRTIO_BALLOON_HINT_BLOCK_ORDER + PAGE_SHIFT))
>   #define VIRTIO_BALLOON_HINT_BLOCK_PAGES (1 << VIRTIO_BALLOON_HINT_BLOCK_ORDER)
>   
> -#ifdef CONFIG_BALLOON_COMPACTION
> -static struct vfsmount *balloon_mnt;
> -#endif
> -
>   enum virtio_balloon_vq {
>   	VIRTIO_BALLOON_VQ_INFLATE,
>   	VIRTIO_BALLOON_VQ_DEFLATE,
> @@ -805,18 +802,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
>   
>   	return MIGRATEPAGE_SUCCESS;
>   }
> -
> -static int balloon_init_fs_context(struct fs_context *fc)
> -{
> -	return init_pseudo(fc, BALLOON_KVM_MAGIC) ? 0 : -ENOMEM;
> -}
> -
> -static struct file_system_type balloon_fs = {
> -	.name           = "balloon-kvm",
> -	.init_fs_context = balloon_init_fs_context,
> -	.kill_sb        = kill_anon_super,
> -};
> -
>   #endif /* CONFIG_BALLOON_COMPACTION */
>   
>   static unsigned long shrink_free_pages(struct virtio_balloon *vb,
> @@ -909,17 +894,11 @@ static int virtballoon_probe(struct virtio_device *vdev)
>   		goto out_free_vb;
>   
>   #ifdef CONFIG_BALLOON_COMPACTION
> -	balloon_mnt = kern_mount(&balloon_fs);
> -	if (IS_ERR(balloon_mnt)) {
> -		err = PTR_ERR(balloon_mnt);
> -		goto out_del_vqs;
> -	}
> -
>   	vb->vb_dev_info.migratepage = virtballoon_migratepage;
> -	vb->vb_dev_info.inode = alloc_anon_inode_sb(balloon_mnt->mnt_sb);
> +	vb->vb_dev_info.inode = alloc_anon_inode();
>   	if (IS_ERR(vb->vb_dev_info.inode)) {
>   		err = PTR_ERR(vb->vb_dev_info.inode);
> -		goto out_kern_unmount;
> +		goto out_del_vqs;
>   	}
>   	vb->vb_dev_info.inode->i_mapping->a_ops = &balloon_aops;
>   #endif
> @@ -1016,8 +995,6 @@ static int virtballoon_probe(struct virtio_device *vdev)
>   out_iput:
>   #ifdef CONFIG_BALLOON_COMPACTION
>   	iput(vb->vb_dev_info.inode);
> -out_kern_unmount:
> -	kern_unmount(balloon_mnt);
>   out_del_vqs:
>   #endif
>   	vdev->config->del_vqs(vdev);
> @@ -1070,7 +1047,6 @@ static void virtballoon_remove(struct virtio_device *vdev)
>   	if (vb->vb_dev_info.inode)
>   		iput(vb->vb_dev_info.inode);
>   
> -	kern_unmount(balloon_mnt);
>   #endif
>   	kfree(vb);
>   }
> 

... you might know what I am going to say :)

Apart from that LGTM.

-- 
Thanks,

David / dhildenb



More information about the Linuxppc-dev mailing list