2011-02-02 20:55:46

by Jim Meyering

[permalink] [raw]
Subject: [PATCH] filefrag: remove useless assignment

Barely worth posting, but...
There's no point in setting fiemap->ANYTHING
when the very next statement zeros the entire buffer.
The correct initialization is already done after the memset.

>From b2e2dd33c57dbae034b9ea7830d21681bc788fbe Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Tue, 1 Feb 2011 19:25:35 +0100
Subject: [PATCH] filefrag: remove useless assignment

The very next one memset's all bytes of fiemap to 0.

Signed-off-by: Jim Meyering <[email protected]>
---
misc/filefrag.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/misc/filefrag.c b/misc/filefrag.c
index bd4486d..d604b6c 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -168,28 +168,26 @@ static int filefrag_fiemap(int fd, int blk_shift, int *num_extents)
struct fiemap *fiemap = (struct fiemap *)buf;
struct fiemap_extent *fm_ext = &fiemap->fm_extents[0];
int count = (sizeof(buf) - sizeof(*fiemap)) /
sizeof(struct fiemap_extent);
unsigned long long last_blk = 0;
unsigned long flags = 0;
unsigned int i;
static int fiemap_incompat_printed;
int fiemap_header_printed = 0;
int tot_extents = 1, n = 0;
int last = 0;
int rc;

- fiemap->fm_length = ~0ULL;


2011-02-07 00:01:55

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] filefrag: remove useless assignment

On Wed, Feb 02, 2011 at 09:55:38PM +0100, Jim Meyering wrote:
> Barely worth posting, but...
> There's no point in setting fiemap->ANYTHING
> when the very next statement zeros the entire buffer.
> The correct initialization is already done after the memset.

Thanks, applied.

- Ted