Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933255AbbLOJDa (ORCPT ); Tue, 15 Dec 2015 04:03:30 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:35189 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932078AbbLOJDY (ORCPT ); Tue, 15 Dec 2015 04:03:24 -0500 X-AuditID: cbfee61b-f793c6d00000236c-6c-566fd75a2be0 From: Fan Li To: "'Jaegeuk Kim'" Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [f2fs-dev] [PATCH] f2fs: fix to reset variable correctlly Date: Tue, 15 Dec 2015 17:02:41 +0800 Message-id: <006301d13717$7325fd20$5971f760$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdE3Fq62nWxzbF1vT6OMJKPsYHIlWg== Content-language: en-us X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t9jAd2o6/lhBpcX6Vk8WT+L2eLSIneL y7vmsDkwe2xa1cnmsXvBZyaPz5vkApijuGxSUnMyy1KL9O0SuDIOvn/DUrCUr+LrzG0sDYxv uboYOTkkBEwkLi3/yg5hi0lcuLeerYuRi0NIYCmjxPJpp5ghnFeMEheufAOrYhNQl9gys5sJ xBYRUJPo3TcFzGYW8JBo7PjOCmILCzhJPNrUCGazCKhKTFn0ixnE5hWwlJj0dCk7hC0o8WPy PZYuRg6gXj2J+xe1IMbIS2xe85YZ4iAFiR1nXzNCrNKTuHT8BDtEjbjEpAcP2ScwCsxCMmkW wqRZSCbNQtKxgJFlFaNEakFyQXFSeq5RXmq5XnFibnFpXrpecn7uJkZwCD+T3sF4eJf7IUYB DkYlHt4frPlhQqyJZcWVuYcYJTiYlUR4v18CCvGmJFZWpRblxxeV5qQWH2KU5mBREufddyky TEggPbEkNTs1tSC1CCbLxMEp1cDIvO2FULb6sqlNwdHfDqys3+g49fGznkNx/4rXVOQVNf/e /SfvbbZr2pITa44VpcwtVLWZ3rhS3W3OaZUL4esYtG9UrJk2uXWOKJOujb721kDOnW7KLB9X pBpWbZ39atPmmBONkz9r5ogcLl1ZLt3w+730WSOPJdwXr2dVl32pqnsdNytNtuWwEktxRqKh FnNRcSIAMaEUyl0CAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2001 Lines: 78 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 --- 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/