From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752669AbcGUTGm (ORCPT ); Thu, 21 Jul 2016 15:06:42 -0400 Received: from mail-yw0-f176.google.com ([209.85.161.176]:35152 "EHLO mail-yw0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbcGUTGj (ORCPT ); Thu, 21 Jul 2016 15:06:39 -0400 Date: Thu, 21 Jul 2016 12:06:06 -0700 From: Omar Sandoval To: Miklos Szeredi Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Chris Mason , Jaegeuk Kim Subject: Re: [PATCH] mm: export filemap_check_errors() to modules Message-ID: <20160721190606.GA1249@vader.DHCP.thefacebook.com> References: <1469097618-3238-1-git-send-email-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1469097618-3238-1-git-send-email-mszeredi@redhat.com> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2016 at 12:40:18PM +0200, Miklos Szeredi wrote: > And use it instead of opencoding in btrfs, f2fs and in fuse (coming up). > > Signed-off-by: Miklos Szeredi > Cc: Chris Mason > Cc: Jaegeuk Kim > --- > fs/btrfs/ctree.h | 1 - > fs/btrfs/inode.c | 15 --------------- > fs/btrfs/tree-log.c | 4 ++-- > fs/f2fs/node.c | 7 ++----- > include/linux/fs.h | 1 + > mm/filemap.c | 3 ++- > 6 files changed, 7 insertions(+), 24 deletions(-) > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index 4274a7bfdaed..425834193259 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -3129,7 +3129,6 @@ int btrfs_prealloc_file_range_trans(struct inode *inode, > struct btrfs_trans_handle *trans, int mode, > u64 start, u64 num_bytes, u64 min_size, > loff_t actual_len, u64 *alloc_hint); > -int btrfs_inode_check_errors(struct inode *inode); > extern const struct dentry_operations btrfs_dentry_operations; > #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS > void btrfs_test_inode_set_ops(struct inode *inode); > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 4421954720b8..b22841625333 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -10489,21 +10489,6 @@ out_inode: > > } > > -/* Inspired by filemap_check_errors() */ > -int btrfs_inode_check_errors(struct inode *inode) > -{ > - int ret = 0; > - > - if (test_bit(AS_ENOSPC, &inode->i_mapping->flags) && > - test_and_clear_bit(AS_ENOSPC, &inode->i_mapping->flags)) > - ret = -ENOSPC; > - if (test_bit(AS_EIO, &inode->i_mapping->flags) && > - test_and_clear_bit(AS_EIO, &inode->i_mapping->flags)) > - ret = -EIO; > - > - return ret; > -} > - > static const struct inode_operations btrfs_dir_inode_operations = { > .getattr = btrfs_getattr, > .lookup = btrfs_lookup, > diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c > index c05f69a8ec42..3c29b9357392 100644 > --- a/fs/btrfs/tree-log.c > +++ b/fs/btrfs/tree-log.c > @@ -3944,7 +3944,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans, > * i_mapping flags, so that the next fsync won't get > * an outdated io error too. > */ > - btrfs_inode_check_errors(inode); > + filemap_check_errors(inode->i_mapping); > *ordered_io_error = true; > break; > } > @@ -4181,7 +4181,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, > * without writing to the log tree and the fsync must report the > * file data write error and not commit the current transaction. > */ > - ret = btrfs_inode_check_errors(inode); > + ret = filemap_check_errors(inode->i_mapping); > if (ret) > ctx->io_err = ret; > process: Btrfs part looks fine. Reviewed-by: Omar Sandoval -- Omar From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 21 Jul 2016 12:06:06 -0700 From: Omar Sandoval To: Miklos Szeredi Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Chris Mason , Jaegeuk Kim Subject: Re: [PATCH] mm: export filemap_check_errors() to modules Message-ID: <20160721190606.GA1249@vader.DHCP.thefacebook.com> References: <1469097618-3238-1-git-send-email-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1469097618-3238-1-git-send-email-mszeredi@redhat.com> Sender: owner-linux-mm@kvack.org List-ID: On Thu, Jul 21, 2016 at 12:40:18PM +0200, Miklos Szeredi wrote: > And use it instead of opencoding in btrfs, f2fs and in fuse (coming up). > > Signed-off-by: Miklos Szeredi > Cc: Chris Mason > Cc: Jaegeuk Kim > --- > fs/btrfs/ctree.h | 1 - > fs/btrfs/inode.c | 15 --------------- > fs/btrfs/tree-log.c | 4 ++-- > fs/f2fs/node.c | 7 ++----- > include/linux/fs.h | 1 + > mm/filemap.c | 3 ++- > 6 files changed, 7 insertions(+), 24 deletions(-) > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index 4274a7bfdaed..425834193259 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -3129,7 +3129,6 @@ int btrfs_prealloc_file_range_trans(struct inode *inode, > struct btrfs_trans_handle *trans, int mode, > u64 start, u64 num_bytes, u64 min_size, > loff_t actual_len, u64 *alloc_hint); > -int btrfs_inode_check_errors(struct inode *inode); > extern const struct dentry_operations btrfs_dentry_operations; > #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS > void btrfs_test_inode_set_ops(struct inode *inode); > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 4421954720b8..b22841625333 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -10489,21 +10489,6 @@ out_inode: > > } > > -/* Inspired by filemap_check_errors() */ > -int btrfs_inode_check_errors(struct inode *inode) > -{ > - int ret = 0; > - > - if (test_bit(AS_ENOSPC, &inode->i_mapping->flags) && > - test_and_clear_bit(AS_ENOSPC, &inode->i_mapping->flags)) > - ret = -ENOSPC; > - if (test_bit(AS_EIO, &inode->i_mapping->flags) && > - test_and_clear_bit(AS_EIO, &inode->i_mapping->flags)) > - ret = -EIO; > - > - return ret; > -} > - > static const struct inode_operations btrfs_dir_inode_operations = { > .getattr = btrfs_getattr, > .lookup = btrfs_lookup, > diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c > index c05f69a8ec42..3c29b9357392 100644 > --- a/fs/btrfs/tree-log.c > +++ b/fs/btrfs/tree-log.c > @@ -3944,7 +3944,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans, > * i_mapping flags, so that the next fsync won't get > * an outdated io error too. > */ > - btrfs_inode_check_errors(inode); > + filemap_check_errors(inode->i_mapping); > *ordered_io_error = true; > break; > } > @@ -4181,7 +4181,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, > * without writing to the log tree and the fsync must report the > * file data write error and not commit the current transaction. > */ > - ret = btrfs_inode_check_errors(inode); > + ret = filemap_check_errors(inode->i_mapping); > if (ret) > ctx->io_err = ret; > process: Btrfs part looks fine. Reviewed-by: Omar Sandoval -- Omar -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org