[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200403064331.GA23270@lst.de>
Date: Fri, 3 Apr 2020 08:43:31 +0200
From: Christoph Hellwig <hch@....de>
To: Anthony Iliopoulos <ailiop@...e.com>
Cc: Christoph Hellwig <hch@....de>, Sagi Grimberg <sagi@...mberg.me>,
Chaitanya Kulkarni <chaitanya.kulkarni@....com>,
linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org
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@...e.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.
Powered by blists - more mailing lists