Re: [RFC PATCH 14/39] KVM: guest_memfd: hugetlb: initialization and cleanup
From: Vishal Annapurve
Date: Fri Sep 20 2024 - 05:18:09 EST
On Wed, Sep 11, 2024 at 1:44 AM Ackerley Tng <ackerleytng@xxxxxxxxxx> wrote:
>
> ...
> +}
> +
> +static void kvm_gmem_evict_inode(struct inode *inode)
> +{
> + u64 flags = (u64)inode->i_private;
> +
> + if (flags & KVM_GUEST_MEMFD_HUGETLB)
> + kvm_gmem_hugetlb_teardown(inode);
> + else
> + truncate_inode_pages_final(inode->i_mapping);
> +
> + clear_inode(inode);
> +}
> +
> static const struct super_operations kvm_gmem_super_operations = {
> .statfs = simple_statfs,
> + .evict_inode = kvm_gmem_evict_inode,
Ackerley, can we use free_inode[1] callback to free any special
metadata associated with the inode instead of relying on
super_operations?
[1] https://elixir.bootlin.com/linux/v6.11/source/include/linux/fs.h#L719
> ...
>
> if (size <= 0 || !PAGE_ALIGNED(size))
> return -EINVAL;
> --
> 2.46.0.598.g6f2099f65c-goog
>