From patchwork Wed Jan 3 08:41:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13509721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C034DC3DA6E for ; Wed, 3 Jan 2024 08:41:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DFF46B032D; Wed, 3 Jan 2024 03:41:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 441D48D0035; Wed, 3 Jan 2024 03:41:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 309FA6B032E; Wed, 3 Jan 2024 03:41:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1F0F66B032C for ; Wed, 3 Jan 2024 03:41:57 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E279A80226 for ; Wed, 3 Jan 2024 08:41:56 +0000 (UTC) X-FDA: 81637357032.09.8E36DE3 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 51E9A100015 for ; Wed, 3 Jan 2024 08:41:55 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Wr7P7dZc; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+f852f126c6d693376302+7437+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+f852f126c6d693376302+7437+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704271315; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gccidn5f1g0i1fYsvQcyie7MyTTk/hQFlVMXwFY3vVk=; b=2ZaP8CBr23Wkh1aXpdqXd6ghvgmDfnnFokMfTkyih7tUDd7ehPVTrAQqtnBf2uUrzfx4J2 JJID2bJE2dLX5goQo4DYsItKm27txiLQ3zqwr0HGXe66BXYY4n7D2p+AW3eUiyjrF963w1 eyyo8kYAhSGqBZ9fcW7MYLA+yEJZQH8= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Wr7P7dZc; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+f852f126c6d693376302+7437+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+f852f126c6d693376302+7437+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704271315; a=rsa-sha256; cv=none; b=qI7vELht5pS4jxZ35eb03ivpwfXN58qYPx0MMwzyOTawiQLuDg4/52U9ReuCqOK+gR/vAR TDWlBoVVvVuIDF30KFe12UcgCVlidqkW7uW6RiPkVTPRRPrKFsoXbyitsym5NlS8Y14Bhx lfzvsYwqJK87SolGkSJ4jN3SNVfE8yk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=gccidn5f1g0i1fYsvQcyie7MyTTk/hQFlVMXwFY3vVk=; b=Wr7P7dZcpevM+eMB5xo39Ltk4n pA70tRCaoJl4lPTsEExNBpd3OQwVjmMBX369i0850YW6oiszU2iNh6eJ757etaMPq8HJ2U+W+Tiqz SNKbAzq95Ssw/VUjWT1aOGgS5maez+iiXrDF5e4zgH6c519czY77Tj4JMoM6+7DIjIcbykslnmzNu h2++TECOXvFTkpJbQnXlTMfGVpoiYzlnSO7122nmP22uEQOnUFb3KTSWAa4E4ASxP4iKje+pcLggt YRmvSy4Hrv9G9XNi9mYpCcdekJrKJRmC4iHq0I744Jh2jylflLQ5zO8cKkhZBUffeWunygETkQTGc 9oGgZdIw==; Received: from [89.144.222.185] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rKwov-00A6bu-1d; Wed, 03 Jan 2024 08:41:50 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 04/15] xfs: remove xfile_stat Date: Wed, 3 Jan 2024 08:41:15 +0000 Message-Id: <20240103084126.513354-5-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240103084126.513354-1-hch@lst.de> References: <20240103084126.513354-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 51E9A100015 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 1zyjsu1dmhg49nyim9a4mq8x461nywes X-HE-Tag: 1704271315-751064 X-HE-Meta: U2FsdGVkX1/tH7dYOP/XE004ilUN4crLNHt0OlmUXRgemM/C/2ag0K9P2D+gOSnudQn++eOxQ7sXUppt+tfsxUlIOWRvVBQzvySo4sjP4ARyGGatdZNycYeLcsoI653PCupQGvBJ/HMNHfEuhzvWJPE/B81i1cpI+6uIcQBZRUFexRvZhjNf5OJZJf8nqED7tBBzpiwM634ypyuNW+9U+NDC31Ff2rXQwqldoBVcIXOfqh4Z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lIq4GzCR8h753BfZ/DjBrQA3AptTvxPQjF7pYzhzWHOfnj1NIGbajEf7I3M0Ij9x2zRArns0RrdTbREnKxsQQ9Bvyacqj3gKQRg8Fw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: vfs_getattr is needed to query inode attributes for unknown underlying file systems. But shmemfs is well known for users of shmem_file_setup and shmem_read_mapping_page_gfp that rely on it not needing specific inode revalidation and having a normal mapping. Remove the detour through the getattr method and an extra wrapper, and just read the inode size and i_bytes directly in the scrub tracing code. Signed-off-by: Christoph Hellwig --- fs/xfs/scrub/trace.h | 34 ++++++++++------------------------ fs/xfs/scrub/xfile.c | 19 ------------------- fs/xfs/scrub/xfile.h | 7 ------- 3 files changed, 10 insertions(+), 50 deletions(-) diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h index 6bbb4e8639dca6..ed9e044f6d603c 100644 --- a/fs/xfs/scrub/trace.h +++ b/fs/xfs/scrub/trace.h @@ -861,18 +861,11 @@ TRACE_EVENT(xfile_destroy, __field(loff_t, size) ), TP_fast_assign( - struct xfile_stat statbuf; - int ret; - - ret = xfile_stat(xf, &statbuf); - if (!ret) { - __entry->bytes = statbuf.bytes; - __entry->size = statbuf.size; - } else { - __entry->bytes = -1; - __entry->size = -1; - } - __entry->ino = file_inode(xf->file)->i_ino; + struct inode *inode = file_inode(xf->file); + + __entry->ino = inode->i_ino; + __entry->bytes = inode->i_bytes; + __entry->size = i_size_read(inode); ), TP_printk("xfino 0x%lx mem_bytes 0x%llx isize 0x%llx", __entry->ino, @@ -891,19 +884,12 @@ DECLARE_EVENT_CLASS(xfile_class, __field(unsigned long long, bytecount) ), TP_fast_assign( - struct xfile_stat statbuf; - int ret; - - ret = xfile_stat(xf, &statbuf); - if (!ret) { - __entry->bytes_used = statbuf.bytes; - __entry->size = statbuf.size; - } else { - __entry->bytes_used = -1; - __entry->size = -1; - } - __entry->ino = file_inode(xf->file)->i_ino; + struct inode *inode = file_inode(xf->file); + + __entry->ino = inode->i_ino; + __entry->bytes_used = inode->i_bytes; __entry->pos = pos; + __entry->size = i_size_read(inode); __entry->bytecount = bytecount; ), TP_printk("xfino 0x%lx mem_bytes 0x%llx pos 0x%llx bytecount 0x%llx isize 0x%llx", diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c index 090c3ead43fdf1..87654cdd5ac6f9 100644 --- a/fs/xfs/scrub/xfile.c +++ b/fs/xfs/scrub/xfile.c @@ -291,25 +291,6 @@ xfile_seek_data( return ret; } -/* Query stat information for an xfile. */ -int -xfile_stat( - struct xfile *xf, - struct xfile_stat *statbuf) -{ - struct kstat ks; - int error; - - error = vfs_getattr_nosec(&xf->file->f_path, &ks, - STATX_SIZE | STATX_BLOCKS, AT_STATX_DONT_SYNC); - if (error) - return error; - - statbuf->size = ks.size; - statbuf->bytes = ks.blocks << SECTOR_SHIFT; - return 0; -} - /* * Grab the (locked) page for a memory object. The object cannot span a page * boundary. Returns 0 (and a locked page) if successful, -ENOTBLK if we diff --git a/fs/xfs/scrub/xfile.h b/fs/xfs/scrub/xfile.h index d56643b0f429e1..c602d11560d8ee 100644 --- a/fs/xfs/scrub/xfile.h +++ b/fs/xfs/scrub/xfile.h @@ -63,13 +63,6 @@ xfile_obj_store(struct xfile *xf, const void *buf, size_t count, loff_t pos) loff_t xfile_seek_data(struct xfile *xf, loff_t pos); -struct xfile_stat { - loff_t size; - unsigned long long bytes; -}; - -int xfile_stat(struct xfile *xf, struct xfile_stat *statbuf); - int xfile_get_page(struct xfile *xf, loff_t offset, unsigned int len, struct xfile_page *xbuf); int xfile_put_page(struct xfile *xf, struct xfile_page *xbuf);