From patchwork Tue Oct 30 13:18:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Maiolino X-Patchwork-Id: 10660899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DCD371734 for ; Tue, 30 Oct 2018 13:19:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D54AF2A3CD for ; Tue, 30 Oct 2018 13:19:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9AED2A3EB; Tue, 30 Oct 2018 13:19:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 614E22A3CD for ; Tue, 30 Oct 2018 13:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728058AbeJ3WM3 (ORCPT ); Tue, 30 Oct 2018 18:12:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41340 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeJ3WM3 (ORCPT ); Tue, 30 Oct 2018 18:12:29 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FC293003C59; Tue, 30 Oct 2018 13:19:04 +0000 (UTC) Received: from odin.usersys.redhat.com (unknown [10.40.205.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F4BF4F127; Tue, 30 Oct 2018 13:19:02 +0000 (UTC) From: Carlos Maiolino To: linux-fsdevel@vger.kernel.org Cc: sandeen@redhat.com, hch@lst.de, david@fromorbit.com, darrick.wong@oracle.com Subject: [PATCH 09/20] f2fs: Remove direct usage of fiemap_extent_info Date: Tue, 30 Oct 2018 14:18:12 +0100 Message-Id: <20181030131823.29040-10-cmaiolino@redhat.com> In-Reply-To: <20181030131823.29040-1-cmaiolino@redhat.com> References: <20181030131823.29040-1-cmaiolino@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 30 Oct 2018 13:19:04 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct fiemap-extent_info will be gone on future patches, remove its direct usage from f2fs Signed-off-by: Carlos Maiolino Reviewed-by: Chao Yu --- fs/f2fs/data.c | 22 +++++++++++++--------- fs/f2fs/f2fs.h | 4 +--- fs/f2fs/inline.c | 10 +++++++--- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c552e2d1dfbb..8ce60b5954d8 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1327,8 +1327,7 @@ static inline loff_t blk_to_logical(struct inode *inode, sector_t blk) return (blk << inode->i_blkbits); } -static int f2fs_xattr_fiemap(struct inode *inode, - struct fiemap_extent_info *fieinfo) +static int f2fs_xattr_fiemap(struct inode *inode, struct fiemap_ctx *f_ctx) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct page *page; @@ -1367,7 +1366,10 @@ static int f2fs_xattr_fiemap(struct inode *inode, if (!xnid) flags |= FIEMAP_EXTENT_LAST; - err = fiemap_fill_next_extent(fieinfo, 0, phys, len, flags); + err = fiemap_fill_next_extent( + (struct fiemap_extent_info *)f_ctx->fc_data, + 0, phys, len, flags); + if (err || err == 1) return err; } @@ -1392,14 +1394,15 @@ static int f2fs_xattr_fiemap(struct inode *inode, } if (phys) - err = fiemap_fill_next_extent(fieinfo, 0, phys, len, flags); + err = fiemap_fill_next_extent( + (struct fiemap_extent_info *)f_ctx->fc_data, + 0, phys, len, flags); return (err < 0 ? err : 0); } int f2fs_fiemap(struct inode *inode, struct fiemap_ctx *f_ctx) { - struct fiemap_extent_info *fieinfo = f_ctx->fc_data; u64 start = f_ctx->fc_start; u64 len = f_ctx->fc_len; struct buffer_head map_bh; @@ -1422,12 +1425,12 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_ctx *f_ctx) inode_lock(inode); if (f_ctx->fc_flags & FIEMAP_FLAG_XATTR) { - ret = f2fs_xattr_fiemap(inode, fieinfo); + ret = f2fs_xattr_fiemap(inode, f_ctx); goto out; } if (f2fs_has_inline_data(inode)) { - ret = f2fs_inline_data_fiemap(inode, fieinfo, start, len); + ret = f2fs_inline_data_fiemap(inode, f_ctx); if (ret != -EAGAIN) goto out; } @@ -1462,8 +1465,9 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_ctx *f_ctx) if (f2fs_encrypted_inode(inode)) flags |= FIEMAP_EXTENT_DATA_ENCRYPTED; - ret = fiemap_fill_next_extent(fieinfo, logical, - phys, size, flags); + ret = fiemap_fill_next_extent( + (struct fiemap_extent_info *)f_ctx->fc_data, + logical, phys, size, flags); } if (start_blk > last_blk || ret) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 185bb39dd82c..5e4e323ea4c6 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3354,9 +3354,7 @@ void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry, bool f2fs_empty_inline_dir(struct inode *dir); int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx, struct fscrypt_str *fstr); -int f2fs_inline_data_fiemap(struct inode *inode, - struct fiemap_extent_info *fieinfo, - __u64 start, __u64 len); +int f2fs_inline_data_fiemap(struct inode *inode, struct fiemap_ctx *f_ctx); /* * shrinker.c diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 5c152fe08381..353a81317fac 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -671,9 +671,10 @@ int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx, return err < 0 ? err : 0; } -int f2fs_inline_data_fiemap(struct inode *inode, - struct fiemap_extent_info *fieinfo, __u64 start, __u64 len) +int f2fs_inline_data_fiemap(struct inode *inode, struct fiemap_ctx *f_ctx) { + u64 start = f_ctx->fc_start; + u64 len = f_ctx->fc_len; __u64 byteaddr, ilen; __u32 flags = FIEMAP_EXTENT_DATA_INLINE | FIEMAP_EXTENT_NOT_ALIGNED | FIEMAP_EXTENT_LAST; @@ -704,7 +705,10 @@ int f2fs_inline_data_fiemap(struct inode *inode, byteaddr = (__u64)ni.blk_addr << inode->i_sb->s_blocksize_bits; byteaddr += (char *)inline_data_addr(inode, ipage) - (char *)F2FS_INODE(ipage); - err = fiemap_fill_next_extent(fieinfo, start, byteaddr, ilen, flags); + err = fiemap_fill_next_extent( + (struct fiemap_extent_info *)f_ctx->fc_data, + start, byteaddr, ilen, flags); + out: f2fs_put_page(ipage, 1); return err;