Skip to content

fix: cap mkfs progress at 96% with hint for large disks - #50

Closed
tianming-1996 wants to merge 2 commits into
linuxdeepin:develop/eaglefrom
tianming-1996:develop/eagle
Closed

tianming-1996 wants to merge 2 commits into
linuxdeepin:develop/eaglefrom
tianming-1996:develop/eagle

Conversation

@tianming-1996

@tianming-1996 tianming-1996 commented Nov 3, 2026 •

Copy link
Copy Markdown

修复:格式化 EXT3 卡在 99% (BUG-291279)

根因

MainWindow::initConnect() 中 mkfs(快速格式化)路径使用固定速率模拟进度(0.06/300ms),约 5 秒到达 0.99 上限后停住。大容量磁盘 mkfs.ext3 实际耗时数分钟,进度条长时间卡在 99%,给用户造成"卡死"的错觉。

修复方案(方案B)

  1. 将模拟进度上限从 0.99 改为 0.95
  2. 进度停住时显示提示文字 "Creating file system, large capacity disks may take longer, please wait..."
  3. 不改变 completed 信号链路:DUDisksJob::completed → setProgress(1) → onFormatingFinished 保持不变

改动文件

  • view/formatingpage.h — 新增 QLabel* m_hintLabel 成员和 setHintText() 方法
  • view/formatingpage.cpp — 在 initUI() 中创建 hint label,实现 setHintText()
  • view/mainwindow.cpp — 0.99 → 0.95,新增 setHintText() 调用

验证

  • Demo 复现确认:原代码进度在 5.1s 到达 0.99 并停住 24.9s(模拟 30s mkfs)
  • 修复后 rehearsal:进度在 4.8s 到达 0.95 停住,completed 信号到达后正常到 100%

PMS

PMS: BUG-291279

Summary by Sourcery

Keep formatting progress below completion and show a wait message while large-disk file-system creation continues.

New Features:

  • Add a formatting-progress hint explaining that creating file systems on large-capacity disks may take longer.

Bug Fixes:

  • Prevent quick-format progress from appearing stuck near completion while the file system is still being created.

Enhancements:

  • Stop simulated progress below completion until the actual formatting job finishes.

1. Root cause: mkfs (fast format) simulates progress with fixed-rate
   increment (0.06/300ms), capping at 0.99 in ~5 seconds; large disk
   mkfs.ext3 takes minutes, leaving progress stuck at 99%
2. Fix: cap simulated progress at 0.95 instead of 0.99, add hint text
   "Creating file system, large capacity disks may take longer,
   please wait..." when progress caps; completed signal chain unchanged
3. Impact: only mkfs format path affected; erase format path and
   completion signal chain remain unchanged

Log: Cap mkfs simulated progress at 95% and add waiting hint text

Influence:
1. Test mkfs format on small disk (progress should complete normally)
2. Test mkfs format on large disk (progress caps at 95% with hint)
3. Verify erase format path is unaffected

fix: mkfs 模拟进度上限改为 95% 并添加大容量磁盘提示

1. 根因:mkfs(快速格式化)使用固定速率(0.06/300ms)模拟进度,约 5
   秒到达 0.99 上限;大容量磁盘 mkfs.ext3 耗时数分钟,进度卡在 99%
2. 方案:将模拟进度上限从 0.99 改为 0.95,进度停住时显示提示文字
   "正在创建文件系统,大容量磁盘可能需要较长时间,请耐心等待...",
   不改变 completed 信号链路
3. 影响:仅影响 mkfs 格式化路径;erase 格式化路径和完成信号链路不变

Log: mkfs 模拟进度上限改为 95% 并添加大容量磁盘等待提示

Influence:
1. 测试小容量磁盘 mkfs 格式化(进度正常完成)
2. 测试大容量磁盘 mkfs 格式化(进度停在 95% 并显示提示)
3. 验证 erase 格式化路径不受影响

PMS: BUG-291279
@tianming-1996
tianming-1996 marked this pull request as draft November 3, 2026 15:12
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tianming-1996

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Reviewer's Guide

Prevents large-disk EXT3 formatting from appearing stuck at 99% by stopping simulated progress at 95% and showing a localized wait hint, while leaving completion handling unchanged.

Sequence diagram for capped filesystem formatting progress

sequenceDiagram
    participant MainWindow
    participant FormatingPage
    participant ProgressTimer
    participant DUDisksJob

    MainWindow->>ProgressTimer: start(300)
    loop simulated progress
        ProgressTimer->>MainWindow: timeout()
        MainWindow->>FormatingPage: setProgress(0.95)
        MainWindow->>FormatingPage: setHintText(tr(...))
    end
    DUDisksJob-->>MainWindow: completed
    MainWindow->>FormatingPage: setProgress(1)
    MainWindow->>MainWindow: onFormatingFinished
Loading

File-Level Changes

Change Details Files
Cap simulated mkfs progress below completion and display a wait message while the real formatting job continues.
  • Lower the simulated progress ceiling from 99% to 95%.
  • Show a localized hint explaining that large-capacity disks may take longer.
  • Preserve the existing completion signal path so the actual job still advances progress to 100%.
view/mainwindow.cpp
Add an optional, centered hint label to the formatting page UI.
  • Create and hide a word-wrapped hint label during UI initialization.
  • Expose a setter that assigns and shows the hint text.
view/formatingpage.h
view/formatingpage.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot:

如果你是以企业贡献者的身份进行提交,请联系我们签署企业贡献者许可协议
If you submit as corporate contributor, please contact us to sign our Corporate Contributor License Agreement

感谢您的提交,我们非常感谢。 像许多开源项目一样,在接受您的贡献之前,我们要求您签署我们的个人贡献者许可协议。 您只需发布与以下格式相同的评论即可签署个人贡献者许可协议。
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Individual Contributor License Agreement before we can accept your contribution. You can sign the Individual Contributor License Agreement by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA.

deepin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

1. Root cause: mkfs (fast format) simulates progress with fixed-rate
   increment (0.06/300ms), capping at 0.99 in ~5 seconds; large disk
   mkfs.ext3 takes minutes, leaving progress stuck at 99%
2. Fix: cap simulated progress at 0.96 instead of 0.99, add hint text
   "Creating file system, large capacity disks may take longer,
   please wait..." when progress caps; stop timer after capping to
   avoid repeated setHintText() calls; update SPDX copyright year to
   2026; update .ts translation template with new string
3. Impact: only mkfs format path affected; erase format path and
   completion signal chain remain unchanged

Log: Cap mkfs simulated progress at 96% and add waiting hint text

Influence:
1. Test mkfs format on small disk (progress should complete normally)
2. Test mkfs format on large disk (progress caps at 96% with hint)
3. Verify erase format path is unaffected

fix: mkfs 模拟进度上限改为 96% 并添加大容量磁盘提示

1. 根因:mkfs(快速格式化)使用固定速率(0.06/300ms)模拟进度,约 5
   秒到达 0.99 上限;大容量磁盘 mkfs.ext3 耗时数分钟,进度卡在 99%
2. 方案:将模拟进度上限从 0.99 改为 0.96,进度停住时显示提示文字
   "正在创建文件系统,大容量磁盘可能需要较长时间,请耐心等待...",
   停止定时器避免重复调用 setHintText();更新 SPDX 版权年份为 2026;
   更新 .ts 翻译模板添加新字符串
3. 影响:仅影响 mkfs 格式化路径;erase 格式化路径和完成信号链路不变

Log: mkfs 模拟进度上限改为 96% 并添加大容量磁盘等待提示

Influence:
1. 测试小容量磁盘 mkfs 格式化(进度正常完成)
2. 测试大容量磁盘 mkfs 格式化(进度停在 96% 并显示提示)
3. 验证 erase 格式化路径不受影响

Bug: BUG-291279
@tianming-1996 tianming-1996 changed the title fix: cap mkfs progress at 95% with hint for large disks fix: cap mkfs progress at 96% with hint for large disks Nov 4, 2026
@tianming-1996

Copy link
Copy Markdown
Author

此 PR 已被 #51 取代。

#51 保留了 0.99 封顶不变,仅补充提示文字,并额外修复了失败重试时提示残留的问题。

切换原因:将封顶值从 0.99 改为 0.95 会因 0.06 × 16 = 0.96 先显示 96%、下一拍才进 else 设成 95%,导致进度条倒退一格;而 95% 与 99% 在用户感知上无区别,真正解决"像卡死"的是提示文字。保留 0.99 即完全不动已有进度逻辑,零回归风险。

关闭此 PR。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants