/* * Valid flags for a dirty buffer
*/ enum {
PG_BUSY = 0, /* nfs_{un}lock_request */
PG_MAPPED, /* page private set for buffered io */
PG_FOLIO, /* Tracking a folio (unset for O_DIRECT) */
PG_CLEAN, /* write succeeded */
PG_COMMIT_TO_DS, /* used by pnfs layouts */
PG_INODE_REF, /* extra ref held by inode when in writeback */
PG_HEADLOCK, /* page group lock of wb_head */
PG_TEARDOWN, /* page group sync for destroy */
PG_UNLOCKPAGE, /* page group sync bit in read path */
PG_UPTODATE, /* page group sync bit in read path */
PG_WB_END, /* page group sync bit in write path */
PG_REMOVE, /* page group sync bit in write path */
PG_CONTENDED1, /* Is someone waiting for a lock? */
PG_CONTENDED2, /* Is someone waiting for a lock? */
};
struct nfs_inode; struct nfs_page { struct list_head wb_list; /* Defines state of page: */ union { struct page *wb_page; /* page to read in/write out */ struct folio *wb_folio;
}; struct nfs_lock_context *wb_lock_context; /* lock context info */
pgoff_t wb_index; /* Offset >> PAGE_SHIFT */ unsignedint wb_offset, /* Offset & ~PAGE_MASK */
wb_pgbase, /* Start of page data */
wb_bytes; /* Length of request */ struct kref wb_kref; /* reference count */ unsignedlong wb_flags; struct nfs_write_verifier wb_verf; /* Commit cookie */ struct nfs_page *wb_this_page; /* list of reqs for this page */ struct nfs_page *wb_head; /* head pointer for req list */ unsignedshort wb_nio; /* Number of I/O attempts */
};
/** * nfs_page_to_folio - Retrieve a struct folio for the request * @req: pointer to a struct nfs_page * * If a folio was assigned to @req, then return it, otherwise return NULL.
*/ staticinlinestruct folio *nfs_page_to_folio(conststruct nfs_page *req)
{ if (test_bit(PG_FOLIO, &req->wb_flags)) return req->wb_folio; return NULL;
}
/** * nfs_page_to_page - Retrieve a struct page for the request * @req: pointer to a struct nfs_page * @pgbase: folio byte offset * * Return the page containing the byte that is at offset @pgbase relative * to the start of the folio. * Note: The request starts at offset @req->wb_pgbase.
*/ staticinlinestruct page *nfs_page_to_page(conststruct nfs_page *req,
size_t pgbase)
{ struct folio *folio = nfs_page_to_folio(req);
/** * nfs_page_to_inode - Retrieve an inode for the request * @req: pointer to a struct nfs_page
*/ staticinlinestruct inode *nfs_page_to_inode(conststruct nfs_page *req)
{ struct folio *folio = nfs_page_to_folio(req);
if (folio == NULL) return req->wb_page->mapping->host; return folio->mapping->host;
}
/** * nfs_page_max_length - Retrieve the maximum possible length for a request * @req: pointer to a struct nfs_page * * Returns the maximum possible length of a request
*/ staticinline size_t nfs_page_max_length(conststruct nfs_page *req)
{ struct folio *folio = nfs_page_to_folio(req);
if (folio == NULL) return PAGE_SIZE; return folio_size(folio);
}
/* * Lock the page of an asynchronous request
*/ staticinlineint
nfs_lock_request(struct nfs_page *req)
{ return !test_and_set_bit(PG_BUSY, &req->wb_flags);
}
/** * nfs_list_add_request - Insert a request into a list * @req: request * @head: head of list into which to insert the request.
*/ staticinlinevoid
nfs_list_add_request(struct nfs_page *req, struct list_head *head)
{
list_add_tail(&req->wb_list, head);
}
/** * nfs_list_move_request - Move a request to a new list * @req: request * @head: head of list into which to insert the request.
*/ staticinlinevoid
nfs_list_move_request(struct nfs_page *req, struct list_head *head)
{
list_move_tail(&req->wb_list, head);
}
/** * nfs_list_remove_request - Remove a request from its wb_list * @req: request
*/ staticinlinevoid
nfs_list_remove_request(struct nfs_page *req)
{ if (list_empty(&req->wb_list)) return;
list_del_init(&req->wb_list);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.