kernels/linux-2.6.24/mm/filemap.c
/**
 * sync_page_range - write and wait on all pages in the passed range
 * @inode:	target inode
 * @mapping:	target address_space
 * @pos:	beginning offset in pages to write
 * @count:	number of bytes to write
 *
 * Write and wait upon all the pages in the passed range.  This is a "data
 * integrity" operation.  It waits upon in-flight writeout before starting and
 * waiting upon new writeout.  If there was an IO error, return it.
 *
 * We need to re-take i_mutex during the generic_osync_inode list walk because
 * it is otherwise livelockable.
 */
write and wait on all pages in the passed range
@inode:      target inode
@mapping:    target address_space
@pos:        beginning offset in pages to write
@count:      number of bytes to write

Write and wait upon all the pages in the passed range.  This is a "data
integrity" operation.  It waits upon in-flight writeout before starting and
waiting upon new writeout.  If there was an IO error, return it.

We need to re-take i_mutex during the generic_osync_inode list walk because
it is otherwise livelockable.
write and wait on all pages in the passed range @inode : target inode @mapping : target address_space @pos : beginning offset in pages to write @count : number of bytes to write Write and wait upon all the pages in the passed range . This is a " data integrity " operation . It waits upon in - flight writeout before starting and waiting upon new writeout . If there was an IO error return it . We need to re - take i_mutex during the generic_osync_inode list walk because it is otherwise livelockable .
int sync_page_range(struct inode *inode, struct address_space *mapping,
			loff_t pos, loff_t count)
{
	pgoff_t start = pos >> PAGE_CACHE_SHIFT;
	pgoff_t end = (pos + count - 1) >> PAGE_CACHE_SHIFT;
	int ret;
	if (!mapping_cap_writeback_dirty(mapping) || !count)
		return 0;
	ret = filemap_fdatawrite_range(mapping, pos, pos + count - 1);
	if (ret == 0) {
		mutex_lock(&inode->i_mutex);
		ret = generic_osync_inode(inode, mapping, OSYNC_METADATA);
		mutex_unlock(&inode->i_mutex);
	}
	if (ret == 0)
		ret = wait_on_page_writeback_range(mapping, start, end);
	return ret;
}
int sync_page_range ( struct inode * inode , struct address_space * mapping , loff_t pos , loff_t count ) { pgoff_t start = pos >> PAGE_CACHE_SHIFT ; pgoff_t end = ( pos + count - 1 ) >> PAGE_CACHE_SHIFT ; int ret ; if ( ! mapping_cap_writeback_dirty ( mapping ) || ! count ) return 0 ; ret = filemap_fdatawrite_range ( mapping , pos , pos + count - 1 ) ; if ( ret == 0 ) { mutex_lock ( & inode -> i_mutex ) ; ret = generic_osync_inode ( inode , mapping , OSYNC_METADATA ) ; mutex_unlock ( & inode -> i_mutex ) ; } if ( ret == 0 ) ret = wait_on_page_writeback_range ( mapping , start , end ) ; return ret ; }
sync_page_range - write and wait on all pages in the passed range
 @inode:      target inode
 @mapping:    target address_space
 @pos:        beginning offset in pages to write
 @count:      number of bytes to write
sync_page_range - write and wait on all pages in the passed range @inode : target inode @mapping : target address_space @pos : beginning offset in pages to write @count : number of bytes to write