fs/nfs/blocklayout/dev.c
Source file repositories/reference/linux-study-clean/fs/nfs/blocklayout/dev.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfs/blocklayout/dev.c- Extension
.c- Size
- 14433 bytes
- Lines
- 593
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source 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.
- 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/sunrpc/svc.hlinux/blkdev.hlinux/nfs4.hlinux/nfs_fs.hlinux/nfs_xdr.hlinux/pr.hblocklayout.h../nfs4trace.h
Detected Declarations
function Copyrightfunction bl_register_scsifunction bl_unregister_devfunction bl_register_devfunction bl_free_devicefunction bl_free_deviceid_nodefunction nfs4_block_decode_volumefunction bl_map_simplefunction bl_map_concatfunction bl_map_stripefunction bl_parse_simplefunction bl_validate_designatorfunction bl_open_pathfunction bl_parse_scsifunction bl_parse_slicefunction bl_parse_concatfunction bl_parse_stripefunction bl_parse_deviceidfunction bl_alloc_deviceid_node
Annotated Snippet
if (!bl_register_dev(&dev->children[i])) {
while (i > 0)
bl_unregister_dev(&dev->children[--i]);
return false;
}
}
return true;
}
if (dev->type == PNFS_BLOCK_VOLUME_SCSI)
return bl_register_scsi(dev);
return true;
}
static void
bl_free_device(struct pnfs_block_dev *dev)
{
bl_unregister_dev(dev);
if (dev->nr_children) {
int i;
for (i = 0; i < dev->nr_children; i++)
bl_free_device(&dev->children[i]);
kfree(dev->children);
} else {
if (dev->bdev_file)
fput(dev->bdev_file);
}
}
void
bl_free_deviceid_node(struct nfs4_deviceid_node *d)
{
struct pnfs_block_dev *dev =
container_of(d, struct pnfs_block_dev, node);
bl_free_device(dev);
kfree_rcu(dev, node.rcu);
}
static int
nfs4_block_decode_volume(struct xdr_stream *xdr, struct pnfs_block_volume *b)
{
__be32 *p;
int i;
p = xdr_inline_decode(xdr, 4);
if (!p)
return -EIO;
b->type = be32_to_cpup(p++);
switch (b->type) {
case PNFS_BLOCK_VOLUME_SIMPLE:
p = xdr_inline_decode(xdr, 4);
if (!p)
return -EIO;
b->simple.nr_sigs = be32_to_cpup(p++);
if (!b->simple.nr_sigs || b->simple.nr_sigs > PNFS_BLOCK_MAX_UUIDS) {
dprintk("Bad signature count: %d\n", b->simple.nr_sigs);
return -EIO;
}
b->simple.len = 4 + 4;
for (i = 0; i < b->simple.nr_sigs; i++) {
p = xdr_inline_decode(xdr, 8 + 4);
if (!p)
return -EIO;
p = xdr_decode_hyper(p, &b->simple.sigs[i].offset);
b->simple.sigs[i].sig_len = be32_to_cpup(p++);
if (b->simple.sigs[i].sig_len > PNFS_BLOCK_UUID_LEN) {
pr_info("signature too long: %d\n",
b->simple.sigs[i].sig_len);
return -EIO;
}
p = xdr_inline_decode(xdr, b->simple.sigs[i].sig_len);
if (!p)
return -EIO;
memcpy(&b->simple.sigs[i].sig, p,
b->simple.sigs[i].sig_len);
b->simple.len += 8 + 4 + \
(XDR_QUADLEN(b->simple.sigs[i].sig_len) << 2);
}
break;
case PNFS_BLOCK_VOLUME_SLICE:
p = xdr_inline_decode(xdr, 8 + 8 + 4);
if (!p)
return -EIO;
Annotation
- Immediate include surface: `linux/sunrpc/svc.h`, `linux/blkdev.h`, `linux/nfs4.h`, `linux/nfs_fs.h`, `linux/nfs_xdr.h`, `linux/pr.h`, `blocklayout.h`, `../nfs4trace.h`.
- Detected declarations: `function Copyright`, `function bl_register_scsi`, `function bl_unregister_dev`, `function bl_register_dev`, `function bl_free_device`, `function bl_free_deviceid_node`, `function nfs4_block_decode_volume`, `function bl_map_simple`, `function bl_map_concat`, `function bl_map_stripe`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.