From patchwork Tue Sep 15 09:02:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Dongsheng X-Patchwork-Id: 7182671 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 164199F380 for ; Tue, 15 Sep 2015 09:36:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39EA320529 for ; Tue, 15 Sep 2015 09:36:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B4A9206F6 for ; Tue, 15 Sep 2015 09:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755018AbbIOJgI (ORCPT ); Tue, 15 Sep 2015 05:36:08 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:53515 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754211AbbIOJJX (ORCPT ); Tue, 15 Sep 2015 05:09:23 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="100730378" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 15 Sep 2015 17:12:10 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t8F993qi008055; Tue, 15 Sep 2015 17:09:03 +0800 Received: from yds-PC.g08.fujitsu.local (10.167.226.66) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 15 Sep 2015 17:09:18 +0800 From: Dongsheng Yang To: , , , CC: , , Dongsheng Yang Subject: [PATCH v3 20/39] ubifs: export read_block() from file.c Date: Tue, 15 Sep 2015 17:02:15 +0800 Message-ID: <1442307754-13233-21-git-send-email-yangds.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1442307754-13233-1-git-send-email-yangds.fnst@cn.fujitsu.com> References: <1442307754-13233-1-git-send-email-yangds.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.66] Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We want to use read_block to read quota file bypass the page cache. So export it from file.c, then we can use it in somewhere else. Signed-off-by: Dongsheng Yang Reviewed-by: Richard Weinberger --- fs/ubifs/file.c | 13 +++++++++++-- fs/ubifs/ubifs.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index c85b4fb..4cff712 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -53,7 +53,16 @@ #include #include -static int read_block(struct inode *inode, void *addr, unsigned int block, +/** + * ubifs_read_block - read a block from inode + * @inode: inode we want to read + * @addr: memory address to put data in + * @block:: block number we want to read + * @dn: ubifs_data_node to search block + * + * This function read a specified block from tnc or media to addr. + */ +int ubifs_read_block(struct inode *inode, void *addr, unsigned int block, struct ubifs_data_node *dn) { struct ubifs_info *c = inode->i_sb->s_fs_info; @@ -140,7 +149,7 @@ static int do_readpage(struct page *page) err = -ENOENT; memset(addr, 0, UBIFS_BLOCK_SIZE); } else { - ret = read_block(inode, addr, block, dn); + ret = ubifs_read_block(inode, addr, block, dn); if (ret) { err = ret; if (err != -ENOENT) diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 5e1a5fe..4215c33 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -1751,6 +1751,8 @@ const struct ubifs_lprops *ubifs_fast_find_frdi_idx(struct ubifs_info *c); int ubifs_calc_dark(const struct ubifs_info *c, int spc); /* file.c */ +int ubifs_read_block(struct inode *inode, void *addr, unsigned int block, + struct ubifs_data_node *dn); int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync); int ubifs_setattr(struct dentry *dentry, struct iattr *attr); int ubifs_update_time(struct inode *inode, struct timespec *time, int flags);