{"id":2234915,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2234915/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260508093428.5814-4-liubaolin12138@163.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.2/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260508093428.5814-4-liubaolin12138@163.com>","list_archive_url":null,"date":"2026-05-08T09:34:28","name":"[v4,v4,3/3] ext4: allow controlling mballoc stats through proc mb_stats","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"aefcfaef0b32b379a75ac30d53aa49587dd2da71","submitter":{"id":89479,"url":"http://patchwork.ozlabs.org/api/1.2/people/89479/?format=json","name":"liubaolin","email":"liubaolin12138@163.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260508093428.5814-4-liubaolin12138@163.com/mbox/","series":[{"id":503354,"url":"http://patchwork.ozlabs.org/api/1.2/series/503354/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=503354","date":"2026-05-08T09:34:26","name":"ext4: improve mballoc statistics reporting and control","version":4,"mbox":"http://patchwork.ozlabs.org/series/503354/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2234915/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2234915/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <SRS0=YYXy=DF=vger.kernel.org=linux-ext4+bounces-16360-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256\n header.s=s110527 header.b=U16ZO1IX;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=yyxy=df=vger.kernel.org=linux-ext4+bounces-16360-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.232.135.74 arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=163.com","gandalf.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256\n header.s=s110527 header.b=U16ZO1IX;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16360-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=163.com header.i=@163.com\n header.b=\"U16ZO1IX\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=220.197.31.3","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=163.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=163.com"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBkWL6sYWz1yKd\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 19:35:42 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4gBkWL6M2Dz4w9g\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 19:35:42 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4gBkWL6G12z4wCG; Fri, 08 May 2026 19:35:42 +1000 (AEST)","from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4gBkWH1ZF3z4w9g\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 08 May 2026 19:35:39 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id DCB37301F37D\n\tfor <patchwork-incoming@ozlabs.org>; Fri,  8 May 2026 09:35:31 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 65C0F2EA498;\n\tFri,  8 May 2026 09:35:29 +0000 (UTC)","from m16.mail.163.com (m16.mail.163.com [220.197.31.3])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E8DB3203B6;\n\tFri,  8 May 2026 09:35:25 +0000 (UTC)","from liubaolin-VMware-Virtual-Platform.localdomain (unknown [])\n\tby gzsmtp2 (Coremail) with SMTP id PSgvCgDXeCEprv1pUW9wDg--.60442S5;\n\tFri, 08 May 2026 17:35:02 +0800 (CST)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1778232942; cv=pass;\n\tb=i1KIdPIrCVEA3Ft1r+/BVjH4JiiF0YqlMM39+NGCukfMMtXX6H3xIaMwrXbCQobpNwCVMWxJGoM9y/zHbfBRxDhcVTMS8PPWEtU3Z46xhUkd/cym/+s0ypOihyevPGpKwYhidFHA5HbveXjaabBM9qI+i7ZoZ56NIXDIcjRLjxyCUhj/1GsO7LhyU8FXMGQVgJqozcftQIDitaZ4bdL1iNloFRolipFTN9hn4s5gwDSQyV3Zbhd5IVdeWbnfw4a+Fz3Y+6tWF+zINFQ+F/1WxvqzI3UjPQPi6BLkiU5oera96as75787FjTlLBLYgQDxNYakK5q0isVuh53P+brYdQ==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778232929; cv=none;\n b=SZPgoS71+CfOMNvE0Di5mt+Iic4Jz5If+Jo0j7N8lSjFSlORP3BoHqb0MQXk1mL5QkKesAwq0frCqOfqvuuswmpwBeQ2Gdnb8YW5MhSAJPFjKC5LigvZj4ks1BtykRUSc2XNIS7P/bFX1wg5mMPAZuXWMxK/LBdzwNTSAToQs3s="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1778232942; c=relaxed/relaxed;\n\tbh=h8+2ejIaLAunVzHWwrUrleLK9mjHS6IbId81JKiL/14=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=yW7IAEsxBTF4ZzXIkLGsFwKtlEjNmketLWIpJs3FMF77nzy6RWrXdPnNawWiQ+UAFtam/Rr/EClDJOmpOG1mSMPQV8qVrkkvRdfEE+prMt3LZfkRSOar8DZueoudp0fJxSjtdTH85AGrhJN3jLSuZuOHmm/pgt735ZdAHXo6X2rC4as09wt5bWD5qrWaWVQVNt1x4h6i8F8dZrO0S5YW8SRyXPr+Mtl6YubvplSGsY7kETuPkb22aefW75ikhhZW88E6gCvs/8DaoVv+EIIxmYtN02x3hlt95q2qZl2jOoDJ2VyoENV5cHpX3nOlapFvuA7GqTfJkQDLA2Viuru+IQ==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778232929; c=relaxed/simple;\n\tbh=96jnxbsa5knuisQeX9tTapZe80ORU7nc+JjtWIozK6M=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=KGo5z5UoOnyQmxe82rdarh/cMOhHtR4BEIp93SZBsLTMFdTVxZTyzhC8dObH1b8/n0tjgge/5/Js5S0mzB/+58jx20/25FTB9lvuAP+2/MgpQIjuji5lEb9kbuNU8xQMeIuGLJGFmTmDFZSZZEHYbruDOlyf+Wbic8oXk6WcbRw="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=163.com; dkim=pass (1024-bit key;\n unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256\n header.s=s110527 header.b=U16ZO1IX; dkim-atps=neutral;\n spf=pass (client-ip=172.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16360-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=163.com;\n spf=pass smtp.mailfrom=163.com;\n dkim=pass (1024-bit key) header.d=163.com header.i=@163.com\n header.b=U16ZO1IX; arc=none smtp.client-ip=220.197.31.3"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;\n\ts=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=h8\n\t+2ejIaLAunVzHWwrUrleLK9mjHS6IbId81JKiL/14=; b=U16ZO1IXdyk3g2c6q3\n\tK2JyTCnMjlJC7CTwVQ4/UZ2hj4TyWVHPUNZxyQli5sUZ6geZwXs12H8+MaI+WyBS\n\tfj/Ug8EkuzuKet9YpfrLTnm9QJPhAIbXXtCklyofMdpgMbFNHx963pb+po1xhqVR\n\tLiBL1T2cjXZFSh48I9caOFyCk=","From":"Baolin Liu <liubaolin12138@163.com>","To":"tytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tlibaokun@linux.alibaba.com","Cc":"ojaswin@linux.ibm.com,\n\tritesh.list@gmail.com,\n\tyi.zhang@huawei.com,\n\tlinux-ext4@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\twangguanyu@vivo.com,\n\tadilger@dilger.ca,\n\tliubaolin12138@163.com,\n\tBaolin Liu <liubaolin@kylinos.cn>","Subject":"[PATCH v4 v4 3/3] ext4: allow controlling mballoc stats through proc\n mb_stats","Date":"Fri,  8 May 2026 17:34:28 +0800","Message-ID":"<20260508093428.5814-4-liubaolin12138@163.com>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20260508093428.5814-1-liubaolin12138@163.com>","References":"<20260508093428.5814-1-liubaolin12138@163.com>","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-CM-TRANSID":"PSgvCgDXeCEprv1pUW9wDg--.60442S5","X-Coremail-Antispam":"1Uf129KBjvJXoW3Gw1kXFy3Ar4rXw13uw47XFb_yoW3tF4kpF\n\tsxAa4xGr1xWa4UCws7Gr4xXw13A3W8C347Kr1I9340gr9IvryFyF1ftrW0yFy5GrWUAa95\n\tXF4j9ryUGr42k37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRFtCcUUUUU=","X-CM-SenderInfo":"xolxutxrol0iasrtmqqrwthudrp/xtbCwgaWYWn9rkZEZwAA3s","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tFREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY\n\tautolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"},"content":"From: Baolin Liu <liubaolin@kylinos.cn>\n\nMake /proc/fs/ext4/<dev>/mb_stats writable. Writing 0 disables mballoc\nstatistics collection, writing 1 enables it, and writing -1 clears the\ncurrent statistics before enabling collection.\nUpdate the ext4 documentation for proc mb_stats, document that the\nsysfs mb_stats entry is deprecated, and point proc.rst to\nDocumentation/admin-guide/ext4.rst for ext4-specific /proc entries.\n\nReviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>\nReviewed-by: Andreas Dilger <adilger@dilger.ca>\nReviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>\nReviewed-by: Zhang Yi <yi.zhang@huawei.com>\nReviewed-by: Baokun Li <libaokun@linux.alibaba.com>\nReviewed-by: Ted Tso <tytso@mit.edu>\nSigned-off-by: Baolin Liu <liubaolin@kylinos.cn>\n---\n Documentation/ABI/testing/sysfs-fs-ext4 |  3 +-\n Documentation/admin-guide/ext4.rst      |  9 ++++-\n Documentation/filesystems/proc.rst      | 13 +------\n fs/ext4/ext4.h                          |  1 +\n fs/ext4/mballoc.c                       | 31 ++++++++++++++++-\n fs/ext4/sysfs.c                         | 46 +++++++++++++++++++++++--\n 6 files changed, 86 insertions(+), 17 deletions(-)","diff":"diff --git a/Documentation/ABI/testing/sysfs-fs-ext4 b/Documentation/ABI/testing/sysfs-fs-ext4\nindex 2edd0a6672d3..7bf06c533343 100644\n--- a/Documentation/ABI/testing/sysfs-fs-ext4\n+++ b/Documentation/ABI/testing/sysfs-fs-ext4\n@@ -5,7 +5,8 @@ Description:\n \t\t Controls whether the multiblock allocator should\n \t\t collect statistics, which are shown during the unmount.\n \t\t 1 means to collect statistics, 0 means not to collect\n-\t\t statistics\n+\t\t statistics. This sysfs entry is deprecated, and users\n+\t\t should prefer /proc/fs/ext4/<disk>/mb_stats.\n \n What:\t\t/sys/fs/ext4/<disk>/mb_group_prealloc\n Date:\t\tMarch 2008\ndiff --git a/Documentation/admin-guide/ext4.rst b/Documentation/admin-guide/ext4.rst\nindex ac0c709ea9e7..ca76e981b2aa 100644\n--- a/Documentation/admin-guide/ext4.rst\n+++ b/Documentation/admin-guide/ext4.rst\n@@ -436,6 +436,12 @@ Files in /proc/fs/ext4/<devname>\n   mb_groups\n         details of multiblock allocator buddy cache of free blocks\n \n+  mb_stats\n+        reports runtime statistics from the multiblock allocator\n+        (mballoc). Writing 0 disables statistics collection, writing\n+        1 enables statistics collection, and writing -1 clears the\n+        current statistics and enables statistics collection.\n+\n /sys entries\n ============\n \n@@ -493,7 +499,8 @@ Files in /sys/fs/ext4/<devname>:\n   mb_stats\n         Controls whether the multiblock allocator should collect statistics,\n         which are shown during the unmount. 1 means to collect statistics, 0\n-        means not to collect statistics.\n+        means not to collect statistics. This sysfs entry is deprecated, and\n+        users should prefer /proc/fs/ext4/<devname>/mb_stats.\n \n   mb_stream_req\n         Files which have fewer blocks than this tunable parameter will have\ndiff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst\nindex b0c0d1b45b99..dd487004b862 100644\n--- a/Documentation/filesystems/proc.rst\n+++ b/Documentation/filesystems/proc.rst\n@@ -1623,18 +1623,7 @@ softirq.\n 1.8 Ext4 file system parameters\n -------------------------------\n \n-Information about mounted ext4 file systems can be found in\n-/proc/fs/ext4.  Each mounted filesystem will have a directory in\n-/proc/fs/ext4 based on its device name (i.e., /proc/fs/ext4/hdc or\n-/proc/fs/ext4/sda9 or /proc/fs/ext4/dm-0).   The files in each per-device\n-directory are shown in Table 1-12, below.\n-\n-.. table:: Table 1-12: Files in /proc/fs/ext4/<devname>\n-\n- ==============  ==========================================================\n- File            Content\n- mb_groups       details of multiblock allocator buddy cache of free blocks\n- ==============  ==========================================================\n+See Documentation/admin-guide/ext4.rst for ext4-specific /proc entries.\n \n 1.9 /proc/consoles\n -------------------\ndiff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex 04bccfcb018e..536589dda8d1 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -2994,6 +2994,7 @@ int ext4_fc_record_regions(struct super_block *sb, int ino,\n extern const struct seq_operations ext4_mb_seq_groups_ops;\n extern const struct seq_operations ext4_mb_seq_structs_summary_ops;\n extern int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset);\n+extern void ext4_mb_stats_clear(struct ext4_sb_info *sbi);\n extern int ext4_mb_init(struct super_block *);\n extern void ext4_mb_release(struct super_block *);\n extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,\ndiff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c\nindex 95103fbc1583..69ee737f8655 100644\n--- a/fs/ext4/mballoc.c\n+++ b/fs/ext4/mballoc.c\n@@ -3208,7 +3208,7 @@ int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset)\n \t\tseq_puts(seq, \"\\tmb stats collection turned off.\\n\");\n \t\tseq_puts(\n \t\t\tseq,\n-\t\t\t\"\\tTo enable, please write \\\"1\\\" to sysfs file mb_stats.\\n\");\n+\t\t\t\"\\tTo enable, please write \\\"1\\\" to proc file mb_stats.\\n\");\n \t\treturn 0;\n \t}\n \tseq_printf(seq, \"\\tblocks_allocated: %u\\n\",\n@@ -4723,6 +4723,35 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)\n \t\ttrace_ext4_mballoc_prealloc(ac);\n }\n \n+void ext4_mb_stats_clear(struct ext4_sb_info *sbi)\n+{\n+\tint i;\n+\n+\tatomic_set(&sbi->s_bal_reqs, 0);\n+\tatomic_set(&sbi->s_bal_success, 0);\n+\tatomic_set(&sbi->s_bal_allocated, 0);\n+\tatomic_set(&sbi->s_bal_groups_scanned, 0);\n+\n+\tfor (i = 0; i < EXT4_MB_NUM_CRS; i++) {\n+\t\tatomic64_set(&sbi->s_bal_cX_hits[i], 0);\n+\t\tatomic64_set(&sbi->s_bal_cX_groups_considered[i], 0);\n+\t\tatomic_set(&sbi->s_bal_cX_ex_scanned[i], 0);\n+\t\tatomic64_set(&sbi->s_bal_cX_failed[i], 0);\n+\t}\n+\n+\tatomic_set(&sbi->s_bal_ex_scanned, 0);\n+\tatomic_set(&sbi->s_bal_goals, 0);\n+\tatomic_set(&sbi->s_bal_stream_goals, 0);\n+\tatomic_set(&sbi->s_bal_len_goals, 0);\n+\tatomic_set(&sbi->s_bal_2orders, 0);\n+\tatomic_set(&sbi->s_bal_breaks, 0);\n+\tatomic_set(&sbi->s_mb_lost_chunks, 0);\n+\tatomic_set(&sbi->s_mb_buddies_generated, 0);\n+\tatomic64_set(&sbi->s_mb_generation_time, 0);\n+\tatomic_set(&sbi->s_mb_preallocated, 0);\n+\tatomic_set(&sbi->s_mb_discarded, 0);\n+}\n+\n /*\n  * Called on failure; free up any blocks from the inode PA for this\n  * context.  We don't need this for MB_GROUP_PA because we only change\ndiff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c\nindex 0f65ab372dee..86e2ae022659 100644\n--- a/fs/ext4/sysfs.c\n+++ b/fs/ext4/sysfs.c\n@@ -52,6 +52,48 @@ typedef enum {\n static const char proc_dirname[] = \"fs/ext4\";\n static struct proc_dir_entry *ext4_proc_root;\n \n+static int ext4_mb_stats_open(struct inode *inode, struct file *file)\n+{\n+\treturn single_open(file, ext4_seq_mb_stats_show, pde_data(inode));\n+}\n+\n+static ssize_t ext4_mb_stats_write(struct file *file, const char __user *buf,\n+\t\t\t\t   size_t count, loff_t *ppos)\n+{\n+\tstruct super_block *sb = pde_data(file_inode(file));\n+\tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n+\tint val;\n+\tint ret;\n+\n+\tret = kstrtoint_from_user(buf, count, 0, &val);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tswitch (val) {\n+\tcase -1:\n+\t\text4_mb_stats_clear(sbi);\n+\t\tfallthrough;\n+\tcase 1:\n+\t\tatomic_set(&sbi->s_mb_stats, 1);\n+\t\tbreak;\n+\tcase 0:\n+\t\tatomic_set(&sbi->s_mb_stats, 0);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn count;\n+}\n+\n+static const struct proc_ops ext4_mb_stats_proc_ops = {\n+\t.proc_open\t= ext4_mb_stats_open,\n+\t.proc_read\t= seq_read,\n+\t.proc_lseek\t= seq_lseek,\n+\t.proc_release\t= single_release,\n+\t.proc_write\t= ext4_mb_stats_write,\n+};\n+\n struct ext4_attr {\n \tstruct attribute attr;\n \tshort attr_id;\n@@ -637,8 +679,8 @@ int ext4_register_sysfs(struct super_block *sb)\n \t\t\t\t\text4_fc_info_show, sb);\n \t\tproc_create_seq_data(\"mb_groups\", S_IRUGO, sbi->s_proc,\n \t\t\t\t&ext4_mb_seq_groups_ops, sb);\n-\t\tproc_create_single_data(\"mb_stats\", 0444, sbi->s_proc,\n-\t\t\t\text4_seq_mb_stats_show, sb);\n+\t\tproc_create_data(\"mb_stats\", 0644, sbi->s_proc,\n+\t\t\t\t &ext4_mb_stats_proc_ops, sb);\n \t\tproc_create_seq_data(\"mb_structs_summary\", 0444, sbi->s_proc,\n \t\t\t\t&ext4_mb_seq_structs_summary_ops, sb);\n \t}\n","prefixes":["v4","v4","3/3"]}