From patchwork Sun Jun 23 06:07:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 253455 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 812192C042D for ; Sun, 23 Jun 2013 16:08:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750805Ab3FWGH6 (ORCPT ); Sun, 23 Jun 2013 02:07:58 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:59237 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063Ab3FWGHz (ORCPT ); Sun, 23 Jun 2013 02:07:55 -0400 Received: by mail-pa0-f49.google.com with SMTP id ld11so9658250pab.36 for ; Sat, 22 Jun 2013 23:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=PLHIX6mQJ+WP+XMnV/wmBuB9F9Mzf1bPBshlWy6ExYM=; b=m66wmcEHnT67Mq4Oi4p/NZL68hmbZfVrlQqHmQxRBU137fye9Fqy6uu/9C6+ZBa40v 7PN4ufooLAZQNhxkxshAcolrX28Vj94iZWGeKwb4ARnP5KrCf8fInp5Q+dGFt40EH2tk DdU7LAc/4i3Vvx+ArBNCAZMREhH2t0fzpw1gKUMt6v3vIELzkLIxFA4ZDNdfbd1/z4pA hqrvwn340JGijXc64KPsf4QXHDGA3Qx5NYvSs5ixjo/UU1mejYUTiZKy5xecw+miQBYJ yYyxvlmGzNBROH2qGBS0DF4aYknzkjTbk+MmNsc0qVi4sug64HFhWB66h04V1QUU7tn7 oyKQ== X-Received: by 10.66.182.166 with SMTP id ef6mr23236481pac.35.1371967674576; Sat, 22 Jun 2013 23:07:54 -0700 (PDT) Received: from linkinjeon-Aspire-One-522.kornet ([59.16.241.238]) by mx.google.com with ESMTPSA id aj3sm5023098pad.8.2013.06.22.23.07.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Jun 2013 23:07:54 -0700 (PDT) From: Namjae Jeon To: tytso@mit.edu, adilger.kernel@dilger.ca Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, a.sangwan@samsung.com, Namjae Jeon , Namjae Jeon Subject: [PATCH 2/3] ext4: make mext_next_extent non static and move get_ext_path Date: Sun, 23 Jun 2013 15:07:48 +0900 Message-Id: <1371967668-3184-1-git-send-email-linkinjeon@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Namjae Jeon This patch makes mext_next_extent non static and moves the defination of get_ext_path to ext4_extents.h as these 2 functions are used by EXT4_IOC_TRANSFER_BLOCK_RANGE introduced in next patch. Signed-off-by: Namjae Jeon Signed-off-by: Ashish Sangwan --- fs/ext4/ext4.h | 2 ++ fs/ext4/ext4_extents.h | 28 ++++++++++++++++++++++++++++ fs/ext4/move_extent.c | 31 +------------------------------ 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index df2c411..246a03a 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2712,6 +2712,8 @@ void ext4_inode_double_unlock(struct inode *inode1, struct inode *inode2); extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 start_orig, __u64 start_donor, __u64 len, __u64 *moved_len); +extern int mext_next_extent(struct inode *inode, struct ext4_ext_path *path, + struct ext4_extent **extent); /* page-io.c */ extern int __init ext4_init_pageio(void); diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h index cc113cc..68f52a1 100644 --- a/fs/ext4/ext4_extents.h +++ b/fs/ext4/ext4_extents.h @@ -278,5 +278,33 @@ static inline void ext4_idx_store_pblock(struct ext4_extent_idx *ix, int __ext4_ext_dirty(const char *where, unsigned int line, handle_t *handle, struct inode *inode, struct ext4_ext_path *path); +/** + * get_ext_path - Find an extent path for designated logical block number. + * + * @inode: an inode which is searched + * @lblock: logical block number to find an extent path + * @path: pointer to an extent path pointer (for output) + * + * ext4_ext_find_extent wrapper. Return 0 on success, or a negative error value + * on failure. + */ +static inline int +get_ext_path(struct inode *inode, ext4_lblk_t lblock, + struct ext4_ext_path **orig_path) +{ + int ret = 0; + struct ext4_ext_path *path; + + path = ext4_ext_find_extent(inode, lblock, *orig_path); + if (IS_ERR(path)) + ret = PTR_ERR(path); + else if (path[ext_depth(inode)].p_ext == NULL) + ret = -ENODATA; + else + *orig_path = path; + + return ret; +} + #endif /* _EXT4_EXTENTS */ diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index e86dddb..dd1e358 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -21,34 +21,6 @@ #include "ext4_extents.h" /** - * get_ext_path - Find an extent path for designated logical block number. - * - * @inode: an inode which is searched - * @lblock: logical block number to find an extent path - * @path: pointer to an extent path pointer (for output) - * - * ext4_ext_find_extent wrapper. Return 0 on success, or a negative error value - * on failure. - */ -static inline int -get_ext_path(struct inode *inode, ext4_lblk_t lblock, - struct ext4_ext_path **orig_path) -{ - int ret = 0; - struct ext4_ext_path *path; - - path = ext4_ext_find_extent(inode, lblock, *orig_path); - if (IS_ERR(path)) - ret = PTR_ERR(path); - else if (path[ext_depth(inode)].p_ext == NULL) - ret = -ENODATA; - else - *orig_path = path; - - return ret; -} - -/** * copy_extent_status - Copy the extent's initialization status * * @src: an extent for getting initialize status @@ -76,8 +48,7 @@ copy_extent_status(struct ext4_extent *src, struct ext4_extent *dest) * ext4_ext_path structure refers to the last extent, or a negative error * value on failure. */ -static int -mext_next_extent(struct inode *inode, struct ext4_ext_path *path, +int mext_next_extent(struct inode *inode, struct ext4_ext_path *path, struct ext4_extent **extent) { struct ext4_extent_header *eh;