kernels/linux-2.4.0/fs/nfs/write.c
/*
 * Create an RPC task for the given write request and kick it.
 * The page must have been locked by the caller.
 *
 * It may happen that the page we're passed is not marked dirty.
 * This is the case if nfs_updatepage detects a conflicting request
 * that has been written but not committed.
 */
Create an RPC task for the given write request and kick it.
The page must have been locked by the caller.

It may happen that the page we're passed is not marked dirty.
This is the case if nfs_updatepage detects a conflicting request
that has been written but not committed.
Create an RPC task for the given write request and kick it . The page must have been locked by the caller . It may happen that the page we ' re passed is not marked dirty . This is the case if nfs_updatepage detects a conflicting request that has been written but not committed .
static int
nfs_flush_one(struct list_head *head, struct inode *inode, int how)
{
	struct rpc_clnt 	*clnt = NFS_CLIENT(inode);
	struct nfs_write_data	*data;
	struct rpc_task		*task;
	struct rpc_message	msg;
	int                     flags,
				async = !(how & FLUSH_SYNC),
				stable = (how & FLUSH_STABLE);
	sigset_t		oldset;
	data = nfs_writedata_alloc();
	if (!data)
		goto out_bad;
	task = &data->task;
	flags = (async) ? RPC_TASK_ASYNC : 0;
	nfs_write_rpcsetup(head, data);
	if (stable) {
		if (!inode->u.nfs_i.ncommit)
			data->args.stable = NFS_FILE_SYNC;
		else
			data->args.stable = NFS_DATA_SYNC;
	} else
		data->args.stable = NFS_UNSTABLE;
	rpc_init_task(task, clnt, nfs_writeback_done, flags);
	task->tk_calldata = data;
	task->tk_release = nfs_writedata_release;
#ifdef CONFIG_NFS_V3
	msg.rpc_proc = (NFS_PROTO(inode)->version == 3) ? NFS3PROC_WRITE : NFSPROC_WRITE;
#else
	msg.rpc_proc = NFSPROC_WRITE;
#endif
	msg.rpc_argp = &data->args;
	msg.rpc_resp = &data->res;
	msg.rpc_cred = data->cred;
	dprintk("NFS: %4d initiated write call (req %x/%Ld count %d nriov %d)\n",
		task->tk_pid, 
		inode->i_dev,
		(long long)NFS_FILEID(inode),
		data->args.count, data->args.nriov);
	rpc_clnt_sigmask(clnt, &oldset);
	rpc_call_setup(task, &msg, 0);
	rpc_execute(task);
	rpc_clnt_sigunmask(clnt, &oldset);
	return 0;
 out_bad:
	while (!list_empty(head)) {
		struct nfs_page *req = nfs_list_entry(head->next);
		nfs_list_remove_request(req);
		nfs_mark_request_dirty(req);
		nfs_unlock_request(req);
	}
	return -ENOMEM;
}
static int nfs_flush_one ( struct list_head * head , struct inode * inode , int how ) { struct rpc_clnt * clnt = NFS_CLIENT ( inode ) ; struct nfs_write_data * data ; struct rpc_task * task ; struct rpc_message msg ; int flags , async = ! ( how & FLUSH_SYNC ) , stable = ( how & FLUSH_STABLE ) ; sigset_t oldset ; data = nfs_writedata_alloc ( ) ; if ( ! data ) goto out_bad ; task = & data -> task ; flags = ( async ) ? RPC_TASK_ASYNC : 0 ; nfs_write_rpcsetup ( head , data ) ; if ( stable ) { if ( ! inode -> u . nfs_i . ncommit ) data -> args . stable = NFS_FILE_SYNC ; else data -> args . stable = NFS_DATA_SYNC ; } else data -> args . stable = NFS_UNSTABLE ; rpc_init_task ( task , clnt , nfs_writeback_done , flags ) ; task -> tk_calldata = data ; task -> tk_release = nfs_writedata_release ; #ifdef CONFIG_NFS_V3 msg . rpc_proc = ( NFS_PROTO ( inode ) -> version == 3 ) ? NFS3PROC_WRITE : NFSPROC_WRITE ; #else msg . rpc_proc = NFSPROC_WRITE ; #endif msg . rpc_argp = & data -> args ; msg . rpc_resp = & data -> res ; msg . rpc_cred = data -> cred ; dprintk ( " \n " , task -> tk_pid , inode -> i_dev , ( long long ) NFS_FILEID ( inode ) , data -> args . count , data -> args . nriov ) ; rpc_clnt_sigmask ( clnt , & oldset ) ; rpc_call_setup ( task , & msg , 0 ) ; rpc_execute ( task ) ; rpc_clnt_sigunmask ( clnt , & oldset ) ; return 0 ; out_bad : while ( ! list_empty ( head ) ) { struct nfs_page * req = nfs_list_entry ( head -> next ) ; nfs_list_remove_request ( req ) ; nfs_mark_request_dirty ( req ) ; nfs_unlock_request ( req ) ; } return - ENOMEM ; }
Create an RPC task for the given write request and kick it.
Create an RPC task for the given write request and kick it .
/* Set the initial flags for the task.  */ /* Set up the argument struct */ /* Finalize the task. */ /* Release requests */