From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jaegeuk Kim Subject: Re: f2fs: Add f2fs_balance_fs for direct IO Date: Tue, 8 Jul 2014 00:58:43 -0700 Message-ID: <20140708075843.GA59558@jmac> References: <1404711988-18264-1-git-send-email-ying.huang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1X4QIf-0001FG-Ls for linux-f2fs-devel@lists.sourceforge.net; Tue, 08 Jul 2014 07:58:53 +0000 Received: from mail.kernel.org ([198.145.19.201]) by sog-mx-2.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1X4QId-0007OT-W9 for linux-f2fs-devel@lists.sourceforge.net; Tue, 08 Jul 2014 07:58:53 +0000 Content-Disposition: inline In-Reply-To: <1404711988-18264-1-git-send-email-ying.huang@intel.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Huang Ying Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Hi Huang, It occurs a merge conflict. Please check the patch. Anyway, IMO, it needs to place f2fs_balance_fs somewhere in get_data_block. Thanks, On Mon, Jul 07, 2014 at 01:46:28PM +0800, Huang Ying wrote: > Otherwise, if a large amount of direct IO writes were done, the > segment allocation may be failed because no enough segments are gced. > > Signed-off-by: Huang, Ying > --- > fs/f2fs/data.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -1038,6 +1038,7 @@ static ssize_t f2fs_direct_IO(int rw, st > { > struct file *file = iocb->ki_filp; > struct inode *inode = file->f_mapping->host; > + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); > > /* Let buffer I/O handle the inline data case. */ > if (f2fs_has_inline_data(inode)) > @@ -1046,8 +1047,11 @@ static ssize_t f2fs_direct_IO(int rw, st > if (check_direct_IO(inode, rw, iter, offset)) > return 0; > > + if (rw == WRITE) > + f2fs_balance_fs(sbi); > + > /* clear fsync mark to recover these blocks */ > - fsync_mark_clear(F2FS_SB(inode->i_sb), inode->i_ino); > + fsync_mark_clear(sbi, inode->i_ino); > > return blockdev_direct_IO(rw, iocb, inode, iter, offset, > get_data_block); -- Jaegeuk Kim ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753151AbaGHH6s (ORCPT ); Tue, 8 Jul 2014 03:58:48 -0400 Received: from mail.kernel.org ([198.145.19.201]:53692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbaGHH6q (ORCPT ); Tue, 8 Jul 2014 03:58:46 -0400 Date: Tue, 8 Jul 2014 00:58:43 -0700 From: Jaegeuk Kim To: Huang Ying Cc: Changman Lee , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: f2fs: Add f2fs_balance_fs for direct IO Message-ID: <20140708075843.GA59558@jmac> References: <1404711988-18264-1-git-send-email-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1404711988-18264-1-git-send-email-ying.huang@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Huang, It occurs a merge conflict. Please check the patch. Anyway, IMO, it needs to place f2fs_balance_fs somewhere in get_data_block. Thanks, On Mon, Jul 07, 2014 at 01:46:28PM +0800, Huang Ying wrote: > Otherwise, if a large amount of direct IO writes were done, the > segment allocation may be failed because no enough segments are gced. > > Signed-off-by: Huang, Ying > --- > fs/f2fs/data.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -1038,6 +1038,7 @@ static ssize_t f2fs_direct_IO(int rw, st > { > struct file *file = iocb->ki_filp; > struct inode *inode = file->f_mapping->host; > + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); > > /* Let buffer I/O handle the inline data case. */ > if (f2fs_has_inline_data(inode)) > @@ -1046,8 +1047,11 @@ static ssize_t f2fs_direct_IO(int rw, st > if (check_direct_IO(inode, rw, iter, offset)) > return 0; > > + if (rw == WRITE) > + f2fs_balance_fs(sbi); > + > /* clear fsync mark to recover these blocks */ > - fsync_mark_clear(F2FS_SB(inode->i_sb), inode->i_ino); > + fsync_mark_clear(sbi, inode->i_ino); > > return blockdev_direct_IO(rw, iocb, inode, iter, offset, > get_data_block); -- Jaegeuk Kim