fs/afs/fsclient.c

Source file repositories/reference/linux-study-clean/fs/afs/fsclient.c

File Facts

System
Linux kernel
Corpus path
fs/afs/fsclient.c
Extension
.c
Size
50818 bytes
Lines
2135
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (call->operation_ID == FSFETCHDATA64) {
			afs_extract_to_tmp64(call);
		} else {
			call->tmp_u = htonl(0);
			afs_extract_to_tmp(call);
		}
		fallthrough;

		/* Extract the returned data length into ->remaining.
		 * This may indicate more or less data than was
		 * requested will be returned.
		 */
	case 1:
		_debug("extract data length");
		ret = afs_extract_data(call, true);
		if (ret < 0)
			return ret;

		call->remaining = be64_to_cpu(call->tmp64);
		_debug("DATA length: %llu", call->remaining);

		if (call->remaining == 0)
			goto no_more_data;

		call->iter = &subreq->io_iter;
		call->iov_len = umin(call->remaining, subreq->len - subreq->transferred);
		call->unmarshall++;
		fallthrough;

		/* extract the returned data */
	case 2:
		count_before = call->iov_len;
		_debug("extract data %zu/%llu", count_before, call->remaining);

		ret = afs_extract_data(call, true);
		subreq->transferred += count_before - call->iov_len;
		call->remaining -= count_before - call->iov_len;
		if (ret < 0)
			return ret;

		call->iter = &call->def_iter;
		if (call->remaining)
			goto no_more_data;

		/* Discard any excess data the server gave us */
		afs_extract_discard(call, call->remaining);
		call->unmarshall = 3;
		fallthrough;

	case 3:
		_debug("extract discard %zu/%llu",
		       iov_iter_count(call->iter), call->remaining);

		ret = afs_extract_data(call, true);
		if (ret < 0)
			return ret;

	no_more_data:
		call->unmarshall = 4;
		afs_extract_to_buf(call, (21 + 3 + 6) * 4);
		fallthrough;

		/* extract the metadata */
	case 4:
		ret = afs_extract_data(call, false);
		if (ret < 0)
			return ret;

		bp = call->buffer;
		xdr_decode_AFSFetchStatus(&bp, call, &vp->scb);
		xdr_decode_AFSCallBack(&bp, call, &vp->scb);
		xdr_decode_AFSVolSync(&bp, &op->volsync);

		if (subreq->start + subreq->transferred >= vp->scb.status.size)
			__set_bit(NETFS_SREQ_HIT_EOF, &subreq->flags);

		call->unmarshall++;
		fallthrough;

	case 5:
		break;
	}

	_leave(" = 0 [done]");
	return 0;
}

/*
 * FS.FetchData operation type
 */

Annotation

Implementation Notes