Re: [RFC PATCH 13/20] famfs: Add iomap_ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 23 Feb 2024 11:41:57 -0600
John Groves <John@xxxxxxxxxx> wrote:

> This commit introduces the famfs iomap_ops. When either
> dax_iomap_fault() or dax_iomap_rw() is called, we get a callback
> via our iomap_begin() handler. The question being asked is
> "please resolve (file, offset) to (daxdev, offset)". The function
> famfs_meta_to_dax_offset() does this.
> 
> The per-file metadata is just an extent list to the
> backing dax dev.  The order of this resolution is O(N) for N
> extents. Note with the current user space, files usually have
> only one extent.
> 
> Signed-off-by: John Groves <john@xxxxxxxxxx>

> ---
>  fs/famfs/famfs_file.c | 245 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 245 insertions(+)
>  create mode 100644 fs/famfs/famfs_file.c
> 
> diff --git a/fs/famfs/famfs_file.c b/fs/famfs/famfs_file.c
> new file mode 100644
> index 000000000000..fc667d5f7be8
> --- /dev/null
> +++ b/fs/famfs/famfs_file.c
> @@ -0,0 +1,245 @@

> +static int
> +famfs_meta_to_dax_offset(
> +	struct inode *inode,
> +	struct iomap *iomap,
> +	loff_t        offset,
> +	loff_t        len,
> +	unsigned int  flags)
> +{
> +	struct famfs_file_meta *meta = (struct famfs_file_meta *)inode->i_private;

i_private is void * so no need for explicit cast (C spec says this is always fine without)


> +
> +/**
> + * famfs_iomap_begin()
> + *
> + * This function is pretty simple because files are
> + * * never partially allocated
> + * * never have holes (never sparse)
> + * * never "allocate on write"
> + */
> +static int
> +famfs_iomap_begin(
> +	struct inode	       *inode,
> +	loff_t			offset,
> +	loff_t			length,
> +	unsigned int		flags,
> +	struct iomap	       *iomap,
> +	struct iomap	       *srcmap)
> +{
> +	struct famfs_file_meta *meta = inode->i_private;
> +	size_t size;
> +	int rc;
> +
> +	size = i_size_read(inode);
> +
> +	WARN_ON(size != meta->file_size);
> +
> +	rc = famfs_meta_to_dax_offset(inode, iomap, offset, length, flags);
> +
> +	return rc;
	return famfs_meta_...

> +}


> +static vm_fault_t
> +famfs_filemap_map_pages(
> +	struct vm_fault	       *vmf,
> +	pgoff_t			start_pgoff,
> +	pgoff_t			end_pgoff)
> +{
> +	vm_fault_t ret;
> +
> +	ret = filemap_map_pages(vmf, start_pgoff, end_pgoff);
> +	return ret;
	return filename_map_pages()....

> +}
> +
>





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux