BTRFS_I(inode)->sequence++;
if (unlikely(file->f_flags & O_DIRECT)) {
- ret = btrfs_delalloc_reserve_space(inode, count);
- if (ret)
- goto out;
-
num_written = generic_file_direct_write(iocb, iov, &nr_segs,
pos, ppos, count,
ocount);
-
/*
* the generic O_DIRECT will update in-memory i_size after the
* DIOs are done. But our endio handlers that update the on
}
if (num_written < 0) {
- if (num_written != -EIOCBQUEUED) {
- /*
- * aio land will take care of releasing the
- * delalloc
- */
- btrfs_delalloc_release_space(inode, count);
- }
ret = num_written;
num_written = 0;
goto out;
pos = *ppos;
goto out;
}
-
- /*
- * the buffered IO will reserve bytes for the rest of the
- * range, don't double count them here
- */
- btrfs_delalloc_release_space(inode, count - num_written);
-
/*
* We are going to do buffered for the rest of the range, so we
* need to make sure to invalidate the buffered pages when we're
* important optimization for directories because holding the mutex prevents
* new operations on the dir while we write to disk.
*/
-int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
+int btrfs_sync_file(struct file *file, int datasync)
{
+ struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret = 0;