release/src/linux/linux/fs/nfs/write.c
/*
 * Check whether the file range we want to write to is locked by
 * us.
 */
Check whether the file range we want to write to is locked by
us.
Check whether the file range we want to write to is locked by us .
static int
region_locked(struct inode *inode, struct nfs_page *req)
{
	struct file_lock	*fl;
	loff_t			rqstart, rqend;
	if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)
		return 0;
	rqstart = page_offset(req->wb_page) + req->wb_offset;
	rqend = rqstart + req->wb_bytes;
	for (fl = inode->i_flock; fl; fl = fl->fl_next) {
		if (fl->fl_owner == current->files && (fl->fl_flags & FL_POSIX)
		    && fl->fl_type == F_WRLCK
		    && fl->fl_start <= rqstart && rqend <= fl->fl_end) {
			return 1;
		}
	}
	return 0;
}
static int region_locked ( struct inode * inode , struct nfs_page * req ) { struct file_lock * fl ; loff_t rqstart , rqend ; if ( NFS_SERVER ( inode ) -> flags & NFS_MOUNT_NONLM ) return 0 ; rqstart = page_offset ( req -> wb_page ) + req -> wb_offset ; rqend = rqstart + req -> wb_bytes ; for ( fl = inode -> i_flock ; fl ; fl = fl -> fl_next ) { if ( fl -> fl_owner == current -> files && ( fl -> fl_flags & FL_POSIX ) && fl -> fl_type == F_WRLCK && fl -> fl_start <= rqstart && rqend <= fl -> fl_end ) { return 1 ; } } return 0 ; }
Check whether the file range we want to write to is locked by
 us.
Check whether the file range we want to write to is locked by us .
/* Don't optimize writes if we don't use NLM */