fs/nfs/pnfs_nfs.c
Source file repositories/reference/linux-study-clean/fs/nfs/pnfs_nfs.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/pnfs_nfs.c- Extension
.c- Size
- 31137 bytes
- Lines
- 1226
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/nfs_fs.hlinux/nfs_page.hlinux/sunrpc/addr.hlinux/module.hnfs4session.hinternal.hpnfs.hnetns.hnfs4trace.h
Detected Declarations
function Copyrightfunction pnfs_generic_prepare_to_resend_writesfunction pnfs_generic_write_commit_donefunction pnfs_generic_commit_releasefunction pnfs_free_bucket_lsegfunction pnfs_generic_clear_request_commitfunction pnfs_alloc_commit_arrayfunction pnfs_free_commit_arrayfunction pnfs_find_commit_array_by_lsegfunction list_for_each_entry_rcufunction pnfs_add_commit_arrayfunction pnfs_lookup_commit_arrayfunction pnfs_release_commit_array_lockedfunction pnfs_put_commit_array_lockedfunction pnfs_put_commit_arrayfunction pnfs_get_commit_arrayfunction pnfs_remove_and_free_commit_arrayfunction pnfs_generic_ds_cinfo_release_lsegfunction pnfs_generic_ds_cinfo_destroyfunction pnfs_bucket_scan_ds_commit_listfunction pnfs_bucket_scan_arrayfunction pnfs_generic_scan_commit_listsfunction pnfs_bucket_recover_commit_reqsfunction pnfs_generic_recover_commit_reqsfunction pnfs_bucket_get_committingfunction pnfs_bucket_fetch_commitdatafunction pnfs_generic_retry_commitfunction pnfs_bucket_alloc_ds_commitsfunction pnfs_alloc_ds_commits_listfunction pnfs_generic_commit_pagelistfunction list_for_each_entry_safefunction print_dsfunction same_sockaddrfunction _same_data_server_addrs_lockedfunction list_for_each_entryfunction list_for_each_entryfunction _data_server_lookup_lockedfunction nfs4_pnfs_ds_addr_freefunction destroy_dsfunction nfs4_pnfs_ds_putfunction nfs4_pnfs_remotestrfunction nfs4_pnfs_ds_addfunction nfs4_wait_ds_connectfunction nfs4_clear_ds_conn_bitfunction load_v3_ds_connectfunction nfs4_pnfs_v3_ds_connect_unloadfunction _nfs4_pnfs_v3_ds_connectfunction list_for_each_entry
Annotated Snippet
if (freeme) {
pnfs_put_lseg(freeme);
goto restart;
}
}
return ret;
}
/* Pull everything off the committing lists and dump into @dst. */
void pnfs_generic_recover_commit_reqs(struct list_head *dst,
struct nfs_commit_info *cinfo)
{
struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
struct pnfs_commit_array *array;
unsigned int nwritten;
lockdep_assert_held(&NFS_I(cinfo->inode)->commit_mutex);
rcu_read_lock();
list_for_each_entry_rcu(array, &fl_cinfo->commits, cinfo_list) {
if (!array->lseg || !pnfs_get_commit_array(array))
continue;
rcu_read_unlock();
nwritten = pnfs_bucket_recover_commit_reqs(dst,
array->buckets,
array->nbuckets,
cinfo);
rcu_read_lock();
pnfs_put_commit_array(array, cinfo->inode);
fl_cinfo->nwritten -= nwritten;
}
rcu_read_unlock();
}
EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs);
static struct pnfs_layout_segment *
pnfs_bucket_get_committing(struct list_head *head,
struct pnfs_commit_bucket *bucket,
struct nfs_commit_info *cinfo)
{
struct pnfs_layout_segment *lseg;
struct list_head *pos;
list_for_each(pos, &bucket->committing)
cinfo->ds->ncommitting--;
list_splice_init(&bucket->committing, head);
lseg = pnfs_free_bucket_lseg(bucket);
if (!lseg)
lseg = pnfs_get_lseg(bucket->lseg);
return lseg;
}
static struct nfs_commit_data *
pnfs_bucket_fetch_commitdata(struct pnfs_commit_bucket *bucket,
struct nfs_commit_info *cinfo)
{
struct nfs_commit_data *data = nfs_commitdata_alloc();
if (!data)
return NULL;
data->lseg = pnfs_bucket_get_committing(&data->pages, bucket, cinfo);
return data;
}
static void pnfs_generic_retry_commit(struct pnfs_commit_bucket *buckets,
unsigned int nbuckets,
struct nfs_commit_info *cinfo,
unsigned int idx)
{
struct pnfs_commit_bucket *bucket;
struct pnfs_layout_segment *freeme;
LIST_HEAD(pages);
for (bucket = buckets; idx < nbuckets; bucket++, idx++) {
if (list_empty(&bucket->committing))
continue;
mutex_lock(&NFS_I(cinfo->inode)->commit_mutex);
freeme = pnfs_bucket_get_committing(&pages, bucket, cinfo);
mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex);
nfs_retry_commit(&pages, freeme, cinfo, idx);
pnfs_put_lseg(freeme);
}
}
static unsigned int
pnfs_bucket_alloc_ds_commits(struct list_head *list,
struct pnfs_commit_bucket *buckets,
unsigned int nbuckets,
struct nfs_commit_info *cinfo)
{
struct pnfs_commit_bucket *bucket;
Annotation
- Immediate include surface: `linux/nfs_fs.h`, `linux/nfs_page.h`, `linux/sunrpc/addr.h`, `linux/module.h`, `nfs4session.h`, `internal.h`, `pnfs.h`, `netns.h`.
- Detected declarations: `function Copyright`, `function pnfs_generic_prepare_to_resend_writes`, `function pnfs_generic_write_commit_done`, `function pnfs_generic_commit_release`, `function pnfs_free_bucket_lseg`, `function pnfs_generic_clear_request_commit`, `function pnfs_alloc_commit_array`, `function pnfs_free_commit_array`, `function pnfs_find_commit_array_by_lseg`, `function list_for_each_entry_rcu`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.