From: David Sterba <dsterba@suse.cz>
Date: Tue, 2 Sep 2014 12:03:03 +0200
Patch-mainline: no, not enabled in SLE15 branch
Subject: [PATCH] btrfs; disable defrag of tree roots
References: none
Recursive defrag is supported by userspace tools, defrag of a dir that
in fact defrags tree roots is wrong and has to be fixed in another way.
Signed-off-by: David Sterba <dsterba@suse.cz>
---
fs/btrfs/ioctl.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2384,15 +2384,8 @@ static int btrfs_ioctl_defrag(struct fil
switch (inode->i_mode & S_IFMT) {
case S_IFDIR:
- if (!capable(CAP_SYS_ADMIN)) {
- ret = -EPERM;
- goto out;
- }
- ret = btrfs_defrag_root(root);
- if (ret)
- goto out;
- ret = btrfs_defrag_root(root->fs_info->extent_root);
- break;
+ ret = 0;
+ goto out;
case S_IFREG:
if (!(file->f_mode & FMODE_WRITE)) {
ret = -EINVAL;