【linux内核】nfs回写②

 

struct nfs_pageio_descriptor {
	struct inode		*pg_inode;
  // const struct nfs_pageio_ops nfs_pgio_rw_ops
	const struct nfs_pageio_ops *pg_ops;
  // const struct nfs_rw_ops nfs_rw_write_ops
	const struct nfs_rw_ops *pg_rw_ops;
	int 		pg_ioflags;
	int			pg_error;
  // const struct rpc_call_ops nfs_pgio_common_ops
	const struct rpc_call_ops *pg_rpc_callops;
  // const struct nfs_pgio_completion_ops nfs_async_read_completion_ops
  // const struct nfs_pgio_completion_ops nfs_async_write_completion_ops
	const struct nfs_pgio_completion_ops *pg_completion_ops;
	struct pnfs_layout_segment *pg_lseg;
  // nfs_io_completion.complete: nfs_io_completion_commit
	struct nfs_io_completion *pg_io_completion;
	struct nfs_direct_req	*pg_dreq;
	unsigned int		pg_bsize;	/* default bsize for mirrors */

	u32			pg_mirror_count;
	struct nfs_pgio_mirror	*pg_mirrors;
	struct nfs_pgio_mirror	 pg_mirrors_static[1];
	struct nfs_pgio_mirror	*pg_mirrors_dynamic;
	u32			pg_mirror_idx;	/* current mirror */
	unsigned short		pg_maxretrans;
	unsigned char		  pg_moreio : 1;
};

 

nfs_page分配函数:

nfs_create_request
 └─ __nfs_create_request
     └─ nfs_page_alloc
            

执行函数:

static inline struct nfs_page *nfs_page_alloc(void)
{
	struct nfs_page *p =
		kmem_cache_zalloc(nfs_page_cachep, nfs_io_gfp_mask());
	if (p)
		INIT_LIST_HEAD(&p->wb_list);
	return p;
}

nfs_page 释放函数:

nfs_release_request
 └─ nfs_page_group_destroy
      └─ nfs_free_request
          └─ nfs_page_free 

执行函数:

static inline void
nfs_page_free(struct nfs_page *p)
{
	kmem_cache_free(nfs_page_cachep, p);
}

 

posted @ 2025-12-19 11:03  苏格拉底的落泪  阅读(6)  评论(0)    收藏  举报