diff mbox series

btrfs: remove the useless value assignment in btrfs_defrag_file

Message ID 1605344781-10362-1-git-send-email-kaixuxia@tencent.com (mailing list archive)
State New, archived
Headers show
Series btrfs: remove the useless value assignment in btrfs_defrag_file | expand

Commit Message

Kaixu Xia Nov. 14, 2020, 9:06 a.m. UTC
From: Kaixu Xia <kaixuxia@tencent.com>

The variable ret is overwritten by the following variable defrag_count
and this assignment is useless, so remove it.

Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 fs/btrfs/ioctl.c | 1 -
 1 file changed, 1 deletion(-)

Comments

David Sterba Nov. 16, 2020, 3:13 p.m. UTC | #1
On Sat, Nov 14, 2020 at 05:06:21PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The variable ret is overwritten by the following variable defrag_count
> and this assignment is useless, so remove it.

This could be actually pointing to a bug, please explain why you think
it's correct to remove it and not to return EAGAIN.
Kaixu Xia Nov. 17, 2020, 2:53 a.m. UTC | #2
On 2020/11/16 23:13, David Sterba wrote:
> On Sat, Nov 14, 2020 at 05:06:21PM +0800, xiakaixu1987@gmail.com wrote:
>> From: Kaixu Xia <kaixuxia@tencent.com>
>>
>> The variable ret is overwritten by the following variable defrag_count
>> and this assignment is useless, so remove it.
> 
> This could be actually pointing to a bug, please explain why you think
> it's correct to remove it and not to return EAGAIN.

The right fix should be goto out_ra and return EAGAIN. I will do it
in the next version.

Thanks,
Kaixu
>
diff mbox series

Patch

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 69a384145dc6..5771678281d6 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1518,7 +1518,6 @@  int btrfs_defrag_file(struct inode *inode, struct file *file,
 
 		if (btrfs_defrag_cancelled(fs_info)) {
 			btrfs_debug(fs_info, "defrag_file cancelled");
-			ret = -EAGAIN;
 			break;
 		}