fault_in_pages_readable(buf, bytes); 
maxlen = cur_iov->iov_len - iov_base; if (maxlen > bytes) maxlen = bytes; fault_in_pages_readable(buf, maxlen); 
generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,		unsigned long nr_segs, loff_t pos, loff_t *ppos,		size_t count, ssize_t written){	struct file *file = iocb->ki_filp;	struct address_space * mapping = file->f_mapping;	struct address_space_operations *a_ops = mapping->a_ops;	struct inode 	*inode = mapping->host;	long		status = 0;	struct page	*page;	struct page	*cached_page = NULL;	size_t		bytes;	struct pagevec	lru_pvec;	const struct iovec *cur_iov = iov; /* current iovec */	size_t		iov_base = 0;	   /* offset in the current iovec */	char __user	*buf;	pagevec_init(&lru_pvec, 0);	/*	 * handle partial DIO write.  Adjust cur_iov if needed.	 */	if (likely(nr_segs == 1))		buf = iov->iov_base + written;	else {		filemap_set_next_iovec(&cur_iov, &iov_base, written);		buf = cur_iov->iov_base + iov_base;	}	do {		unsigned long index;		unsigned long offset;		size_t copied;		offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */		index = pos >> PAGE_CACHE_SHIFT;		bytes = PAGE_CACHE_SIZE - offset;		if (bytes > count)			bytes = count;		/*		 * Bring in the user page that we will copy from _first_.		 * Otherwise there's a nasty deadlock on copying from the		 * same page as we're writing to, without it being marked		 * up-to-date.		 */		fault_in_pages_readable(buf, bytes);		page = __grab_cache_page(mapping,index,&cached_page,&lru_pvec);		if (!page) {			status = -ENOMEM;			break;		}		status = a_ops->prepare_write(file, page, offset, offset+bytes);		if (unlikely(status)) {			loff_t isize = i_size_read(inode);			/*			 * prepare_write() may have instantiated a few blocks			 * outside i_size.  Trim these off again.			 */			unlock_page(page);			page_cache_release(page);			if (pos + bytes > isize)				vmtruncate(inode, isize);			break;		}		if (likely(nr_segs == 1))			copied = filemap_copy_from_user(page, offset,							buf, bytes);		else			copied = filemap_copy_from_user_iovec(page, offset,						cur_iov, iov_base, bytes);		flush_dcache_page(page);		status = a_ops->commit_write(file, page, offset, offset+bytes);		if (likely(copied > 0)) {			if (!status)				status = copied;			if (status >= 0) {				written += status;				count -= status;				pos += status;				buf += status;				if (unlikely(nr_segs > 1)) {					filemap_set_next_iovec(&cur_iov,							&iov_base, status);					buf = cur_iov->iov_base + iov_base;				}			}		}		if (unlikely(copied != bytes))			if (status >= 0)				status = -EFAULT;		unlock_page(page);		mark_page_accessed(page);		page_cache_release(page);		if (status < 0)			break;		balance_dirty_pages_ratelimited(mapping);		cond_resched();	} while (count);	*ppos = pos;	if (cached_page)		page_cache_release(cached_page);	/*	 * For now, when the user asks for O_SYNC, we'll actually give O_DSYNC	 */	if (likely(status >= 0)) {		if (unlikely((file->f_flags & O_SYNC) || IS_SYNC(inode))) {			if (!a_ops->writepage || !is_sync_kiocb(iocb))				status = generic_osync_inode(inode, mapping,						OSYNC_METADATA|OSYNC_DATA);		}  	}		/*	 * If we get here for O_DIRECT writes then we must have fallen through	 * to buffered writes (block instantiation inside i_size).  So we sync	 * the file data here, to try to honour O_DIRECT expectations.	 */	if (unlikely(file->f_flags & O_DIRECT) && written)		status = filemap_write_and_wait(mapping);	pagevec_lru_add(&lru_pvec);	return written ? written : status;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/a51171816826b074828fa96cb6ef60fc3b13631a/filemap.c/clean/mm/filemap.c