Repository navigation
[sdio] set block size after block configuration - #11886
BernardXiong wants to merge 3 commits into
Conversation
- initialize block_size only after the host block size is applied - avoid exposing card_blksize before it is configured on the device - keep sector-based geometry consistent for partition probing
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-11-01 00:06 CST)
📝 Review Instructions
|
- initialize the block counter before the SEND_NUM_WR_BLKS request - fix the cppcheck uninitvar warning in mmcsd_num_wr_blocks()
|
| { | ||
| goto _fail; | ||
| } | ||
| blk_dev->geometry.block_size = blk_dev->geometry.bytes_per_sector; |
There was a problem hiding this comment.
此处语义感觉有些奇怪,
此处是要保存设置成功的 blksize ? 感觉和注释有些冲突,并且如果记录设置成功的blksize 使用 MMCSD_SECTOR_SIZE 会不会明确一些
There was a problem hiding this comment.
已按建议修改(commit 1821504):改为显式使用 MMCSD_SECTOR_SIZE 赋值,并补充注释说明语义:
mmcsd_set_blksize()会把卡配置为MMCSD_SECTOR_SIZE传输,这里记录的是配置成功后块层实际使用的块大小;card->card_blksize是 CSD 里的读块长度,不是块层传输的块大小,所以在配置成功前不能上报;geometry.block_size在 block.h 里注释为擦除块大小,SD 卡没有可靠且统一的擦除块信息,这里沿用块层的传输粒度MMCSD_SECTOR_SIZE,与原实现保持一致,只是把赋值时机移到配置成功之后并显式化。
Use MMCSD_SECTOR_SIZE explicitly and document that mmcsd_set_blksize() configured the card for that transfer size. card->card_blksize is the CSD read block length, not the block size used by the block layer, so it must not be reported before the card is configured. Co-Authored-By: Claude Code <noreply@anthropic.com>
拉取/合并请求描述:(PR description)
为什么提交这份PR (why to submit this PR)
rt_mmcsd_blk_probe() stores card->card_blksize in the block device geometry before the block size is applied to the card. Partition probing can then observe a stale block size.
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up