{"id":2219514,"url":"http://patchwork.ozlabs.org/api/patches/2219514/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260403082507.1882703-4-yebin@huaweicloud.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/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":"<20260403082507.1882703-4-yebin@huaweicloud.com>","list_archive_url":null,"date":"2026-04-03T08:25:07","name":"[3/3] ext4: show orphan file inode detail info","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"68908971a4b1171d8e6b0debd540c92a1c4b99fd","submitter":{"id":85089,"url":"http://patchwork.ozlabs.org/api/people/85089/?format=json","name":"Ye Bin","email":"yebin@huaweicloud.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260403082507.1882703-4-yebin@huaweicloud.com/mbox/","series":[{"id":498600,"url":"http://patchwork.ozlabs.org/api/series/498600/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=498600","date":"2026-04-03T08:25:07","name":"show orphan file inode detail info","version":1,"mbox":"http://patchwork.ozlabs.org/series/498600/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2219514/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2219514/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <SRS0=2TAo=CC=vger.kernel.org=linux-ext4+bounces-15623-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 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=2tao=cc=vger.kernel.org=linux-ext4+bounces-15623-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.105.105.114 arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15623-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.56","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=huaweicloud.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 4fnBg46NN2z1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 19:27:44 +1100 (AEDT)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fnBg45NLjz4wT6\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 19:27:44 +1100 (AEDT)","by gandalf.ozlabs.org (Postfix)\n\tid 4fnBg45JxSz4wTH; Fri, 03 Apr 2026 19:27:44 +1100 (AEDT)","from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\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 4fnBg12GGJz4wT6\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 03 Apr 2026 19:27:41 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 2A372302330B\n\tfor <patchwork-incoming@ozlabs.org>; Fri,  3 Apr 2026 08:27:34 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DEB67332EBD;\n\tFri,  3 Apr 2026 08:27:33 +0000 (UTC)","from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com\n [45.249.212.56])\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 AA8032ECEB9\n\tfor <linux-ext4@vger.kernel.org>; Fri,  3 Apr 2026 08:27:29 +0000 (UTC)","from mail.maildlp.com (unknown [172.19.163.198])\n\tby dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4fnBdd6MkszKHMT5\n\tfor <linux-ext4@vger.kernel.org>; Fri,  3 Apr 2026 16:26:29 +0800 (CST)","from mail02.huawei.com (unknown [10.116.40.128])\n\tby mail.maildlp.com (Postfix) with ESMTP id 64C1F40574\n\tfor <linux-ext4@vger.kernel.org>; Fri,  3 Apr 2026 16:27:22 +0800 (CST)","from huaweicloud.com (unknown [10.50.87.132])\n\tby APP4 (Coremail) with SMTP id gCh0CgDHn0roec9pD5T6DA--.40142S7;\n\tFri, 03 Apr 2026 16:27:22 +0800 (CST)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775204864; cv=pass;\n\tb=VG94jXpcdWL5CNYpwa+mK3sz7AfVDCJ4NBEDoS8Q7U1dAHh1M/NQwLdD6GGZRzk9/GOOV7ddD9QmtITf5InpPBMwn84Eyxist8fFYjZlXVPO23FlIfuA/AHQ/2k5Re41hpWKVPppbV49YEOTysmnkJTo/hZ7sIA/SUirvP7owG+5I/QC6Hu0ArRly77xucShQzQMv42c2wIlcDENBPx1g2QWofFDP6jAZ1e0A3BKKDhCufxxThd9D0TVxWpDsT7ZZ2w2BOKqIwiVMKMDaIiw40dVnKBOmMDC7cXu+plQqyUYRFpoMD41zg2Lz1xy2MTy/sN3BiLP5Xp/wqoe1b47DA==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775204853; cv=none;\n b=Q7ksoBbNpQCS4kAbOufl8mamMhOkhv8fA9R5X4ZJwUX/5qiXssK7HQgDrZq8Vr8Ars3h4ngG9bYbPvethQUyX6ytPqC6dVqPeoPHju0AXYM8FG25secUOUqnGsBTXP7IF8fodo4otBVI7oCAqw1sGelX+rJzCzDKhmVsC0hjrdk="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775204864; c=relaxed/relaxed;\n\tbh=n69j1g6e3trQseaFytYKRpqopClchcQ6hv4Hy4Qm1gs=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=ctJmFaRv94YGPCftr+pRxhCrE4QJ45geZmq6e8Q75i3amzvYpnWRlv7RZI6ialtu8yWnsTtOKh6q1MtIjEjVIuAzcgiXx01Yo1qHRm1Bal201AOZpm//8Kvokf+WnGD4ahcMGdwH2heAKM2y+fNnwqiZI/x87MWLXv04dQ+p3T0KYmid9uh+9fNKWFQ59K6rcWrAsoaHDd9Ard4loweejFUFhLAUCV+VCl52NXWgszS2wb/cugDkr2naVRp8LNGc5+pV5PDryL1PZLXn3DfYD3u6CU0/RlZWfEI0nSrgsK1m8IaELrZWeEdjKSfAY2llxAy5RAqHcQHtGuJYa+KToQ==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775204853; c=relaxed/simple;\n\tbh=LzvV8yEfo+zJJs+AjDvGyZbxxX5cjXj465DfE85WIyM=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=nfRpMgRVoeuepZcRwjcadCnPHsG7bp86qe96dJkPBYj1XJJ0CQ+hv7dD28dvSJQE2h3XMVO5vyyXje17rN0TA0absBbrl/pCbJNFi5rwWCl4Mxbl4MYzuiN5fOJY6FRpvuBIH+V73c8I4oO9d2e3UMkpUOUf9RhqM1Gsg03Yqq4="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15623-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56"],"From":"Ye Bin <yebin@huaweicloud.com>","To":"tytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tlinux-ext4@vger.kernel.org","Cc":"jack@suse.cz","Subject":"[PATCH 3/3] ext4: show orphan file inode detail info","Date":"Fri,  3 Apr 2026 16:25:07 +0800","Message-Id":"<20260403082507.1882703-4-yebin@huaweicloud.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260403082507.1882703-1-yebin@huaweicloud.com>","References":"<20260403082507.1882703-1-yebin@huaweicloud.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":"gCh0CgDHn0roec9pD5T6DA--.40142S7","X-Coremail-Antispam":"1UD129KBjvJXoW3AryfCr13KFy8AFW3Jr13Arb_yoW7Ar4kpF\n\t98trykAa1UW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","X-Spam-Status":"No, score=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"},"content":"From: Ye Bin <yebin10@huawei.com>\n\nSupport show inode information in orphan file.\n\nSigned-off-by: Ye Bin <yebin10@huawei.com>\n---\n fs/ext4/orphan.c | 115 ++++++++++++++++++++++++++++++++++++++---------\n 1 file changed, 94 insertions(+), 21 deletions(-)","diff":"diff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c\nindex 272de32d1a47..c01887fb496b 100644\n--- a/fs/ext4/orphan.c\n+++ b/fs/ext4/orphan.c\n@@ -663,6 +663,11 @@ int ext4_orphan_file_empty(struct super_block *sb)\n struct ext4_proc_orphan {\n \tstruct ext4_inode_info cursor;\n \tbool print_title;\n+\tstruct ext4_orphan_info *oi;\n+\tint inodes_per_ob;\n+\tint block_idx;\n+\tint offset;\n+\tbool orphan_file;\n };\n \n static inline bool ext4_is_cursor(struct ext4_inode_info *inode)\n@@ -683,24 +688,65 @@ static struct inode *ext4_list_next(struct list_head *head, struct list_head *p)\n \treturn NULL;\n }\n \n+static struct inode *ext4_orphan_file_next(struct ext4_proc_orphan *s,\n+\t\t\t\t\t   struct super_block *sb)\n+{\n+\tstruct inode *inode;\n+\tstruct ext4_orphan_info *oi = s->oi;\n+\n+\tfor (; s->block_idx < oi->of_blocks; s->block_idx++) {\n+\t\t__le32 *bdata = (__le32 *)(oi->of_binfo[s->block_idx].ob_bh->b_data);\n+\n+\t\tif (atomic_read(&oi->of_binfo[s->block_idx].ob_free_entries) ==\n+\t\t    s->inodes_per_ob) {\n+\t\t\ts->offset = 0;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tfor (; s->offset < s->inodes_per_ob; s->offset++) {\n+\t\t\tif (!bdata[s->offset])\n+\t\t\t\tcontinue;\n+\t\t\tinode = ext4_iget(sb, le32_to_cpu(bdata[s->offset]),\n+\t\t\t\t\t  EXT4_IGET_NORMAL);\n+\t\t\tif (IS_ERR(inode))\n+\t\t\t\tcontinue;\n+\t\t\ts->offset++;\n+\t\t\treturn inode;\n+\t\t}\n+\t\ts->offset = 0;\n+\t}\n+\n+\treturn NULL;\n+}\n+\n static void *ext4_orphan_seq_start(struct seq_file *seq, loff_t *pos)\n {\n \tstruct ext4_proc_orphan *s = seq->private;\n \tstruct super_block *sb = pde_data(file_inode(seq->file));\n \tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n \tstruct list_head *prev;\n+\tvoid *ret;\n \n-\tmutex_lock(&sbi->s_orphan_lock);\n+\tif (!s->orphan_file) {\n+\t\tmutex_lock(&sbi->s_orphan_lock);\n+\t\tif (!*pos)\n+\t\t\tprev = &sbi->s_orphan;\n+\t\telse\n+\t\t\tprev = &s->cursor.i_orphan;\n \n-\tif (!*pos) {\n-\t\tprev = &sbi->s_orphan;\n-\t} else {\n-\t\tprev = &s->cursor.i_orphan;\n-\t\tif (list_empty(prev))\n+\t\tif (!list_empty(prev)) {\n+\t\t\tret = ext4_list_next(&sbi->s_orphan, prev);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n+\t\t}\n+\n+\t\tif (!s->oi)\n \t\t\treturn NULL;\n+\t\tlist_del_init(&s->cursor.i_orphan);\n+\t\tmutex_unlock(&sbi->s_orphan_lock);\n+\t\ts->orphan_file = true;\n \t}\n \n-\treturn ext4_list_next(&sbi->s_orphan, prev);\n+\treturn ext4_orphan_file_next(s, sb);\n }\n \n static void *ext4_orphan_seq_next(struct seq_file *seq, void *v, loff_t *pos)\n@@ -708,10 +754,26 @@ static void *ext4_orphan_seq_next(struct seq_file *seq, void *v, loff_t *pos)\n \tstruct super_block *sb = pde_data(file_inode(seq->file));\n \tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n \tstruct inode *inode = v;\n+\tstruct ext4_proc_orphan *s = seq->private;\n+\tvoid *ret;\n \n \t++*pos;\n \n-\treturn ext4_list_next(&sbi->s_orphan, &EXT4_I(inode)->i_orphan);\n+\tif (!s->orphan_file) {\n+\t\tret = ext4_list_next(&sbi->s_orphan, &EXT4_I(inode)->i_orphan);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t\tif (!s->oi)\n+\t\t\treturn NULL;\n+\t\tlist_del_init(&s->cursor.i_orphan);\n+\t\tmutex_unlock(&sbi->s_orphan_lock);\n+\t\ts->orphan_file = true;\n+\t\tv = NULL;\n+\t}\n+\n+\tiput(v);\n+\n+\treturn ext4_orphan_file_next(s, sb);\n }\n \n static void ext4_show_filename(struct seq_file *seq, struct inode *inode)\n@@ -758,12 +820,16 @@ static void ext4_orphan_seq_stop(struct seq_file *seq, void *v)\n \tstruct inode *inode = v;\n \tstruct ext4_proc_orphan *s = seq->private;\n \n-\tif (inode)\n-\t\tlist_move_tail(&s->cursor.i_orphan, &EXT4_I(inode)->i_orphan);\n-\telse\n-\t\tlist_del_init(&s->cursor.i_orphan);\n+\tif (!s->orphan_file) {\n+\t\tif (inode)\n+\t\t\tlist_move_tail(&s->cursor.i_orphan, &EXT4_I(inode)->i_orphan);\n+\t\telse\n+\t\t\tlist_del_init(&s->cursor.i_orphan);\n \n-\tmutex_unlock(&sbi->s_orphan_lock);\n+\t\tmutex_unlock(&sbi->s_orphan_lock);\n+\t} else {\n+\t\tiput(v);\n+\t}\n }\n \n const struct seq_operations ext4_orphan_seq_ops = {\n@@ -777,16 +843,21 @@ static int ext4_seq_orphan_open(struct inode *inode, struct file *file)\n {\n \tint rc;\n \tstruct seq_file *m;\n-\tstruct ext4_proc_orphan *private;\n+\tstruct ext4_proc_orphan *s;\n \n \trc = seq_open_private(file, &ext4_orphan_seq_ops,\n \t\t\t      sizeof(struct ext4_proc_orphan));\n \tif (!rc) {\n+\t\tstruct super_block *sb = pde_data(file_inode(file));\n \t\tm = file->private_data;\n-\t\tprivate = m->private;\n-\t\tINIT_LIST_HEAD(&private->cursor.i_orphan);\n-\t\tprivate->cursor.vfs_inode.i_ino = 0;\n-\t\tprivate->print_title = true;\n+\t\ts = m->private;\n+\t\tINIT_LIST_HEAD(&s->cursor.i_orphan);\n+\t\ts->cursor.vfs_inode.i_ino = 0;\n+\t\ts->print_title = true;\n+\t\tif (ext4_has_feature_orphan_file(sb)) {\n+\t\t\ts->oi = &EXT4_SB(sb)->s_orphan_info;\n+\t\t\ts->inodes_per_ob = ext4_inodes_per_orphan_block(sb);\n+\t\t}\n \t}\n \n \treturn rc;\n@@ -798,9 +869,11 @@ static int ext4_seq_orphan_release(struct inode *inode, struct file *file)\n \tstruct ext4_proc_orphan *s = seq->private;\n \tstruct ext4_sb_info *sbi = EXT4_SB(pde_data(inode));\n \n-\tmutex_lock(&sbi->s_orphan_lock);\n-\tlist_del(&s->cursor.i_orphan);\n-\tmutex_unlock(&sbi->s_orphan_lock);\n+\tif (!s->orphan_file) {\n+\t\tmutex_lock(&sbi->s_orphan_lock);\n+\t\tlist_del(&s->cursor.i_orphan);\n+\t\tmutex_unlock(&sbi->s_orphan_lock);\n+\t}\n \n \treturn seq_release_private(inode, file);\n }\n","prefixes":["3/3"]}