Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1291946 > unrolled thread

[f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly

Started byFan Li <fanofcode.li@samsung.com>
First post2015-12-15 10:10 +0100
Last post2015-12-15 10:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly Fan Li <fanofcode.li@samsung.com> - 2015-12-15 10:10 +0100
    RE: [f2fs-dev]  [PATCH] f2fs: fix to reset variable correctlly Chao Yu <chao2.yu@samsung.com> - 2015-12-15 10:50 +0100

#1291946 — [f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly

FromFan Li <fanofcode.li@samsung.com>
Date2015-12-15 10:10 +0100
Subject[f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly
Message-ID<qFTMm-1YA-5@gated-at.bofh.it>
f2fs_map_blocks will set m_flags and m_len to 0, so we don't need to
reset m_flags ourselves, but have to reset m_len to correct value
before use it again.

Signed-off-by: Fan li <fanofcode.li@samsung.com>
---
 fs/f2fs/file.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9949d0f..2c8050c 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1700,7 +1700,6 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
 	}
 
 	map.m_lblk = pg_start;
-	map.m_len = pg_end - pg_start;
 
 	/*
 	 * lookup mapping info in dnode page cache, skip defragmenting if all
@@ -1708,14 +1707,13 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
 	 * in logical blocks.
 	 */
 	while (map.m_lblk < pg_end) {
-		map.m_flags = 0;
+		map.m_len = pg_end - map.m_lblk;
 		err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_READ);
 		if (err)
 			goto out;
 
 		if (!(map.m_flags & F2FS_MAP_FLAGS)) {
 			map.m_lblk++;
-			map.m_len--;
 			continue;
 		}
 
@@ -1726,7 +1724,6 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
 		blk_end = map.m_pblk + map.m_len;
 
 		map.m_lblk += map.m_len;
-		map.m_len = pg_end - map.m_lblk;
 	}
 
 	if (!fragmented)
@@ -1752,14 +1749,13 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
 		int cnt = 0;
 
 do_map:
-		map.m_flags = 0;
+		map.m_len = pg_end - map.m_lblk;
 		err = f2fs_map_blocks(inode, &map, 0, F2FS_GET_BLOCK_READ);
 		if (err)
 			goto clear_out;
 
 		if (!(map.m_flags & F2FS_MAP_FLAGS)) {
 			map.m_lblk++;
-			map.m_len--;
 			continue;
 		}
 
@@ -1784,7 +1780,6 @@ do_map:
 		}
 
 		map.m_lblk = idx;
-		map.m_len = pg_end - idx;
 
 		if (idx < pg_end && cnt < blk_per_seg)
 			goto do_map;
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1291989 — RE: [f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly

FromChao Yu <chao2.yu@samsung.com>
Date2015-12-15 10:50 +0100
SubjectRE: [f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly
Message-ID<qFUp4-2e3-21@gated-at.bofh.it>
In reply to#1291946
> -----Original Message-----
> From: Fan Li [mailto:fanofcode.li@samsung.com]
> Sent: Tuesday, December 15, 2015 5:03 PM
> To: 'Jaegeuk Kim'
> Cc: linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
> Subject: [f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly
> 
> f2fs_map_blocks will set m_flags and m_len to 0, so we don't need to
> reset m_flags ourselves, but have to reset m_len to correct value
> before use it again.
> 
> Signed-off-by: Fan li <fanofcode.li@samsung.com>

Reviewed-by: Chao Yu <chao2.yu@samsung.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web