mnt_flags fixes in do_remount()
[safe/jmp/linux-2.6] / fs / btrfs / file.c
index 3d2e45c..feaa13b 100644 (file)
@@ -179,18 +179,14 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
                }
                flags = em->flags;
                if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) {
-                       if (em->start <= start &&
-                           (!testend || em->start + em->len >= start + len)) {
+                       if (testend && em->start + em->len >= start + len) {
                                free_extent_map(em);
                                write_unlock(&em_tree->lock);
                                break;
                        }
-                       if (start < em->start) {
-                               len = em->start - start;
-                       } else {
+                       start = em->start + em->len;
+                       if (testend)
                                len = start + len - (em->start + em->len);
-                               start = em->start + em->len;
-                       }
                        free_extent_map(em);
                        write_unlock(&em_tree->lock);
                        continue;
@@ -776,7 +772,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
        unsigned long last_index;
        int will_write;
 
-       will_write = ((file->f_flags & O_SYNC) || IS_SYNC(inode) ||
+       will_write = ((file->f_flags & O_DSYNC) || IS_SYNC(inode) ||
                      (file->f_flags & O_DIRECT));
 
        nrptrs = min((count + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE,
@@ -943,7 +939,7 @@ out_nolock:
                if (err)
                        num_written = err;
 
-               if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) {
+               if ((file->f_flags & O_DSYNC) || IS_SYNC(inode)) {
                        trans = btrfs_start_transaction(root, 1);
                        ret = btrfs_log_dentry_safe(trans, root,
                                                    file->f_dentry);