/* xfs_iozero clears the specified range of buffer supplied, and marks all the affected blocks as valid and modified. If an affected block is not allocated, it will be allocated. If an affected block is not completely overwritten, and is not valid before the operation, it will be read from disk before being partially zeroed.  */
STATIC int xfs_iozero(struct xfs_inode *ip, loff_t pos, size_t count)
/* xfs_iozero clears the specified range of buffer supplied, and marks all the affected blocks as valid and modified. If an affected block is not allocated, it will be allocated. If an affected block is not completely overwritten, and is not valid before the operation, it will be read from disk before being partially zeroed.  */
STATIC int xfs_iozero(struct xfs_inode *ip, loff_t pos, size_t count)
{
	struct page		*page;
	struct address_space	*mapping;
	int			status;
	mapping = VFS_I(ip)->i_mapping;
	do {
		unsigned offset, bytes;
		void *fsdata;
		offset = (pos & (PAGE_CACHE_SIZE -1));
		bytes = PAGE_CACHE_SIZE - offset;
		if (bytes > count)
			bytes = count;
		status = pagecache_write_begin(NULL, mapping, pos, bytes,
					AOP_FLAG_UNINTERRUPTIBLE,
					&page, &fsdata);
		if (status)
			break;
		zero_user(page, offset, bytes);
		status = pagecache_write_end(NULL, mapping, pos, bytes, bytes,
					page, fsdata);
		WARN_ON(status <= 0);
		pos += bytes;
		count -= bytes;
		status = 0;
	} while (count);
	return (-status);
}