fs: add sync_inode_metadata
[linux-2.6.git] / fs / libfs.c
index 8debe7b..2dbf487 100644 (file)
@@ -892,10 +892,6 @@ EXPORT_SYMBOL_GPL(generic_fh_to_parent);
  */
 int generic_file_fsync(struct file *file, int datasync)
 {
-       struct writeback_control wbc = {
-               .sync_mode = WB_SYNC_ALL,
-               .nr_to_write = 0, /* metadata-only; caller takes care of data */
-       };
        struct inode *inode = file->f_mapping->host;
        int err;
        int ret;
@@ -906,7 +902,7 @@ int generic_file_fsync(struct file *file, int datasync)
        if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
                return ret;
 
-       err = sync_inode(inode, &wbc);
+       err = sync_inode_metadata(inode, 1);
        if (ret == 0)
                ret = err;
        return ret;
@@ -925,6 +921,8 @@ EXPORT_SYMBOL(generic_file_fsync);
 int generic_check_addressable(unsigned blocksize_bits, u64 num_blocks)
 {
        u64 last_fs_block = num_blocks - 1;
+       u64 last_fs_page =
+               last_fs_block >> (PAGE_CACHE_SHIFT - blocksize_bits);
 
        if (unlikely(num_blocks == 0))
                return 0;
@@ -932,10 +930,8 @@ int generic_check_addressable(unsigned blocksize_bits, u64 num_blocks)
        if ((blocksize_bits < 9) || (blocksize_bits > PAGE_CACHE_SHIFT))
                return -EINVAL;
 
-       if ((last_fs_block >
-            (sector_t)(~0ULL) >> (blocksize_bits - 9)) ||
-           (last_fs_block >
-            (pgoff_t)(~0ULL) >> (PAGE_CACHE_SHIFT - blocksize_bits))) {
+       if ((last_fs_block > (sector_t)(~0ULL) >> (blocksize_bits - 9)) ||
+           (last_fs_page > (pgoff_t)(~0ULL))) {
                return -EFBIG;
        }
        return 0;