Messages in this thread | | | Date | Fri, 3 Apr 2020 08:43:31 +0200 | From | Christoph Hellwig <> | Subject | Re: [PATCH] nvmet: add revalidation support to bdev and file backed namespaces |
| |
On Thu, Apr 02, 2020 at 09:30:52PM +0200, Anthony Iliopoulos wrote: > Add support for detecting capacity changes on nvmet blockdev and file > backed namespaces. This allows for emulating and testing online resizing > of nvme devices and filesystems on top. > > Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
I vaguely remember seeing a very similar patch before, is this a repost?
> +void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns) > +{ > + loff_t size; > + > + size = i_size_read(ns->bdev->bd_inode); > + > + if (ns->size != size) > + ns->size = size;
This can be:
ns->size = i_size_read(ns->bdev->bd_inode);
> +void nvmet_file_ns_revalidate(struct nvmet_ns *ns) > +{ > + struct kstat stat; > + > + if (!ns->file) > + return;
Shouldn't this always be non-NULL?
> + > + if (vfs_getattr(&ns->file->f_path, > + &stat, STATX_SIZE, AT_STATX_FORCE_SYNC)) > + return;
Use up the full line:
if (vfs_getattr(&ns->file->f_path, &stat, STATX_SIZE, AT_STATX_FORCE_SYNC))
Also shouldn't there be error handling? If we can't stat the file the namespace is toast.
| |