Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752188AbbGOBki (ORCPT ); Tue, 14 Jul 2015 21:40:38 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:41607 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbbGOBkh (ORCPT ); Tue, 14 Jul 2015 21:40:37 -0400 X-AuditID: cbfee61a-f79516d000006302-ed-55a5ba100842 From: Chao Yu To: "'Jaegeuk Kim'" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <1436901502-78825-1-git-send-email-jaegeuk@kernel.org> In-reply-to: <1436901502-78825-1-git-send-email-jaegeuk@kernel.org> Subject: RE: [f2fs-dev] [PATCH 1/2] f2fs: handle error cases in move_encrypted_block Date: Wed, 15 Jul 2015 09:39:47 +0800 Message-id: <012501d0be9f$3ca52dc0$b5ef8940$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQFCGSI/F+7UFNi5PUCgyk0W0qqb1p75CcWg Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGLMWRmVeSWpSXmKPExsVy+t9jQV2BXUtDDeb857d4sn4Ws8WlRe4W e/aeZLG4vGsOmwOLx6ZVnWweuxd8ZvL4vEkugDmKyyYlNSezLLVI3y6BK2Pmse8sBR1iFU0X 29kbGNcKdTFyckgImEh07rjBDmGLSVy4t56ti5GLQ0hgOqPE6rV7WSGcV4wSX840s4JUsQmo SCzv+M8EYosIqEn07psCZjMLZEpM6H8BNklIwEmi8dMaZhCbU8BZ4tGcySwgtrBAmETLgeVg 9SwCqhK3Ji0Bq+EVsJR4tn4FG4QtKPFj8j0WiJlaEut3HoeaLy+xec1bZohLFSR2nH3NCHGD kcSr702MEDXiEhuP3GKZwCg0C8moWUhGzUIyahaSlgWMLKsYRVMLkguKk9JzDfWKE3OLS/PS 9ZLzczcxgkP/mdQOxpUNFocYBTgYlXh4by5ZGirEmlhWXJl7iFGCg1lJhHdSD1CINyWxsiq1 KD++qDQntfgQozQHi5I478l8n1AhgfTEktTs1NSC1CKYLBMHp1QDI0/uxt6uI+r3JjvPbREI +vyqtcph3akph8vaxRWnnn5hkHPwq5m3bYiH1Ov9+z9fezjF2JP/7+xUxz/n7vTlrwyum634 qbbp8KEX/dfOp2ifP7rscuWMlfqCVdJKMtkb9rTOf79iXeXbq2wr+7Qe7PvBOGfy70MC7tV1 HsILSoKffX0ol1J44LYSS3FGoqEWc1FxIgAsviAxeQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2979 Lines: 95 Hi Jaegeuk, > -----Original Message----- > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org] > Sent: Wednesday, July 15, 2015 3:18 AM > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org; > linux-f2fs-devel@lists.sourceforge.net > Cc: Jaegeuk Kim > Subject: [f2fs-dev] [PATCH 1/2] f2fs: handle error cases in move_encrypted_block > > This patch fixes some missing error handlers. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/gc.c | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 11046db..db11861 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -556,27 +556,34 @@ static void move_encrypted_block(struct inode *inode, block_t bidx) > if (!fio.encrypted_page) > goto put_out; > > - f2fs_submit_page_bio(&fio); > - > - /* allocate block address */ > - f2fs_wait_on_page_writeback(dn.node_page, NODE); > - > - allocate_data_block(fio.sbi, NULL, fio.blk_addr, > - &fio.blk_addr, &sum, CURSEG_COLD_DATA); > - dn.data_blkaddr = fio.blk_addr; > + err = f2fs_submit_page_bio(&fio); > + if (err) > + goto put_page_out; f2fs_submit_page_bio will put the page when failed. So goto put_out is enough? > > /* write page */ > lock_page(fio.encrypted_page); > + > + if (unlikely(!PageUptodate(fio.encrypted_page))) > + goto put_page_out; > + if (unlikely(fio.encrypted_page->mapping != META_MAPPING(fio.sbi))) > + goto put_page_out; > + > set_page_writeback(fio.encrypted_page); > fio.rw = WRITE_SYNC; > f2fs_submit_page_mbio(&fio); > > + /* allocate block address */ > + f2fs_wait_on_page_writeback(dn.node_page, NODE); > + allocate_data_block(fio.sbi, NULL, fio.blk_addr, > + &fio.blk_addr, &sum, CURSEG_COLD_DATA); move above f2fs_submit_page_mbio(&fio) to here? Thanks, > + dn.data_blkaddr = fio.blk_addr; > + > set_data_blkaddr(&dn); > f2fs_update_extent_cache(&dn); > set_inode_flag(F2FS_I(inode), FI_APPEND_WRITE); > if (page->index == 0) > set_inode_flag(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN); > - > +put_page_out: > f2fs_put_page(fio.encrypted_page, 1); > put_out: > f2fs_put_dnode(&dn); > -- > 2.1.1 > > > ------------------------------------------------------------------------------ > Don't Limit Your Business. Reach for the Cloud. > GigeNET's Cloud Solutions provide you with the tools and support that > you need to offload your IT needs and focus on growing your business. > Configured For All Businesses. Start Your Cloud Today. > https://www.gigenetcloud.com/ > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel -- 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/