From patchwork Mon May 15 18:57:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9727775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0508460231 for ; Mon, 15 May 2017 18:58:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F06EB289A7 for ; Mon, 15 May 2017 18:58:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4724289BE; Mon, 15 May 2017 18:58:22 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 7CCC3289A7 for ; Mon, 15 May 2017 18:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966069AbdEOS5t (ORCPT ); Mon, 15 May 2017 14:57:49 -0400 Received: from mailrelay116.isp.belgacom.be ([195.238.20.143]:11117 "EHLO mailrelay116.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966061AbdEOS5p (ORCPT ); Mon, 15 May 2017 14:57:45 -0400 X-Belgacom-Dynamic: yes IronPort-PHdr: =?us-ascii?q?9a23=3AISjbNBDiCgWIUFFSsaLaUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSP3yrsbcNUDSrc9gkEXOFd2Crakb26yL6+jJYi8p39WoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6lX71zMZGw3+OAxp?= =?us-ascii?q?Pay1X9eK14Xkn9y1rrTXbhVBgjawe/tMLQ+x5VHPt9MRqZlvLKcvjB/IpGZYPe?= =?us-ascii?q?NMyiV1JgTAsQz745Ke9ZRi+iIYlegs+8NaUK75N/A2RLZWJC8lImY4+IvhuE+Q?= =?us-ascii?q?HkO0+nIAXzBOwVJzCA/f4US/B8+pvw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2AFBAAE+RlZ//gsQldcHAELAQUBgmpsK?= =?us-ascii?q?BqBLI52kRgBlUmCDyGGA4U1QhYBAQEBAQEBAQEBAWoogjMFAR4BBYJpLyOBGiQ?= =?us-ascii?q?TihYRrlk6hBGHGoZfjQSCSgWeCpMODZFrlEMmAi+BCk8eGIRtAU8cgWU+NocQg?= =?us-ascii?q?U8BAQE?= X-IPAS-Result: =?us-ascii?q?A2AFBAAE+RlZ//gsQldcHAELAQUBgmpsKBqBLI52kRgBlUm?= =?us-ascii?q?CDyGGA4U1QhYBAQEBAQEBAQEBAWoogjMFAR4BBYJpLyOBGiQTihYRrlk6hBGHG?= =?us-ascii?q?oZfjQSCSgWeCpMODZFrlEMmAi+BCk8eGIRtAU8cgWU+NocQgU8BAQE?= Received: from 248.44-66-87.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([87.66.44.248]) by relay.skynet.be with ESMTP; 15 May 2017 20:57:31 +0200 From: Fabian Frederick To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, fabf@skynet.be Subject: [PATCH 3/3 linux-next] fs/affs: stat: return block number Date: Mon, 15 May 2017 20:57:30 +0200 Message-Id: <20170515185730.5055-1-fabf@skynet.be> X-Mailer: git-send-email 2.9.3 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 stat doesn't give any block number as it's filesystem specific. Add getattr wrapper to return i_blkcnt calculated during affs_iget() Signed-off-by: Fabian Frederick --- fs/affs/affs.h | 2 ++ fs/affs/file.c | 1 + fs/affs/inode.c | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/fs/affs/affs.h b/fs/affs/affs.h index fd99f28..a2151e9 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h @@ -180,6 +180,8 @@ extern int affs_rename2(struct inode *old_dir, struct dentry *old_dentry, /* inode.c */ extern struct inode *affs_new_inode(struct inode *dir); +extern int affs_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int flags); extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); extern void affs_evict_inode(struct inode *inode); extern struct inode *affs_iget(struct super_block *sb, unsigned long ino); diff --git a/fs/affs/file.c b/fs/affs/file.c index 196ee7f..b331abb 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -979,4 +979,5 @@ const struct file_operations affs_file_operations = { const struct inode_operations affs_file_inode_operations = { .setattr = affs_notify_change, + .getattr = affs_getattr, }; diff --git a/fs/affs/inode.c b/fs/affs/inode.c index fd4ef3c..76fb281 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -214,6 +214,17 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc) return 0; } +int affs_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int flags) +{ + struct inode *inode = d_inode(path->dentry); + + generic_fillattr(inode, stat); + stat->blocks = AFFS_I(inode)->i_blkcnt; + + return 0; +} + int affs_notify_change(struct dentry *dentry, struct iattr *attr) {