Skip to content

Commit cae6681

Browse files
Yihang Limartinkpetersen
authored andcommitted
scsi: hisi_sas: Add latest_dump for the debugfs dump
Before that, after the user triggers the dump, the latest dump information can be viewed in the directory with the maximum number in the dump directory. After this series patch, the driver creates all debugfs directories and files during initialization. Therefore, users cannot know the directory where the latest dump information is stored. So, add latest_dump file to notify users where the latest dump information is stored. Signed-off-by: Yihang Li <liyihang9@huawei.com> Link: https://lore.kernel.org/r/20241008021822.2617339-14-liyihang9@huawei.com Reviewed-by: Xingui Yang <yangxingui@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 9f564f1 commit cae6681

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4814,13 +4814,30 @@ static void debugfs_bist_init_v3_hw(struct hisi_hba *hisi_hba)
48144814
hisi_hba->debugfs_bist_linkrate = SAS_LINK_RATE_1_5_GBPS;
48154815
}
48164816

4817+
static int debugfs_dump_index_v3_hw_show(struct seq_file *s, void *p)
4818+
{
4819+
int *debugfs_dump_index = s->private;
4820+
4821+
if (*debugfs_dump_index > 0)
4822+
seq_printf(s, "%d\n", *debugfs_dump_index - 1);
4823+
else
4824+
seq_puts(s, "dump not triggered\n");
4825+
4826+
return 0;
4827+
}
4828+
DEFINE_SHOW_ATTRIBUTE(debugfs_dump_index_v3_hw);
4829+
48174830
static void debugfs_dump_init_v3_hw(struct hisi_hba *hisi_hba)
48184831
{
48194832
int i;
48204833

48214834
hisi_hba->debugfs_dump_dentry =
48224835
debugfs_create_dir("dump", hisi_hba->debugfs_dir);
48234836

4837+
debugfs_create_file("latest_dump", 0400, hisi_hba->debugfs_dump_dentry,
4838+
&hisi_hba->debugfs_dump_index,
4839+
&debugfs_dump_index_v3_hw_fops);
4840+
48244841
for (i = 0; i < hisi_sas_debugfs_dump_count; i++)
48254842
debugfs_create_files_v3_hw(hisi_hba, i);
48264843
}

0 commit comments

Comments
 (0)