Skip to content

badblocks: actually round to block boundaries in set/clear/check - #1375

Closed
ghost wants to merge 1 commit into
linus-master_basefrom
series/1176508=>linus-master
Closed

ghost wants to merge 1 commit into
linus-master_basefrom
series/1176508=>linus-master

Conversation

@ghost

@ghost ghost commented Sep 30, 2026

Copy link
Copy Markdown

Pull request for series with
subject: badblocks: actually round to block boundaries in set/clear/check
version: 1
url: https://patchwork.kernel.org/series/1176508/

@ghost

ghost commented Sep 30, 2026

Copy link
Copy Markdown
Author

Upstream branch: 72d3fcf
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost

ghost commented Oct 1, 2026

Copy link
Copy Markdown
Author

Upstream branch: 551c722
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 3bac240 to 7adc579 Compare October 1, 2026 15:27
@ghost
ghost force-pushed the linus-master_base branch from eebb5bc to bbd3af0 Compare October 1, 2026 23:18
@ghost

ghost commented Oct 1, 2026

Copy link
Copy Markdown
Author

Upstream branch: ce1e022
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 7adc579 to 02d52e6 Compare October 1, 2026 23:26
@ghost
ghost force-pushed the linus-master_base branch from bbd3af0 to a9c0b46 Compare October 3, 2026 09:37
@ghost

ghost commented Oct 3, 2026

Copy link
Copy Markdown
Author

Upstream branch: e767a4e
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 02d52e6 to fe7ee4a Compare October 3, 2026 09:43
@ghost
ghost force-pushed the linus-master_base branch from a9c0b46 to 72d0f5e Compare October 3, 2026 21:50
@ghost

ghost commented Oct 3, 2026

Copy link
Copy Markdown
Author

Upstream branch: a74306e
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from fe7ee4a to 0523d24 Compare October 3, 2026 22:03
@ghost
ghost force-pushed the linus-master_base branch from 72d0f5e to d980ad5 Compare October 5, 2026 02:03
@ghost

ghost commented Oct 5, 2026

Copy link
Copy Markdown
Author

Upstream branch: None
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 0523d24 to 339a162 Compare October 5, 2026 02:10
@ghost
ghost force-pushed the linus-master_base branch from d980ad5 to 83b99cc Compare October 6, 2026 12:35
@ghost

ghost commented Oct 6, 2026

Copy link
Copy Markdown
Author

Upstream branch: 22430ae
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 339a162 to 02f3eda Compare October 6, 2026 12:42
@ghost ghost added V1-ci-fail and removed V1-ci-pass labels Oct 6, 2026
@ghost
ghost force-pushed the linus-master_base branch from 83b99cc to 9081535 Compare October 6, 2026 16:58
@ghost

ghost commented Oct 6, 2026

Copy link
Copy Markdown
Author

Upstream branch: 69f80fe
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 02f3eda to 53068ab Compare October 6, 2026 17:06
@ghost

ghost commented Oct 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: 7b63ef2
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 53068ab to ee7bab9 Compare October 7, 2026 15:25
@ghost

ghost commented Oct 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 58161ea
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 5aa9109 to ba2dce3 Compare October 17, 2026 04:00
@ghost
ghost force-pushed the linus-master_base branch from 3d027d5 to 90ea7e4 Compare October 19, 2026 00:00
@ghost

ghost commented Oct 19, 2026

Copy link
Copy Markdown
Author

Upstream branch: c03c1a1
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from ba2dce3 to 9954b86 Compare October 19, 2026 00:43
@ghost
ghost force-pushed the linus-master_base branch from 90ea7e4 to 435b194 Compare October 22, 2026 07:21
@ghost

ghost commented Oct 22, 2026

Copy link
Copy Markdown
Author

Upstream branch: 7be4bc5
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 9954b86 to b5a35d9 Compare October 22, 2026 08:10
@ghost
ghost force-pushed the linus-master_base branch from 435b194 to fd67522 Compare October 24, 2026 03:36
@ghost

ghost commented Oct 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: 17bb0e2
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from b5a35d9 to 0fdfab2 Compare October 24, 2026 04:17
@ghost
ghost force-pushed the linus-master_base branch from fd67522 to 3b53a63 Compare October 26, 2026 01:52
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: 21a7f44
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 0fdfab2 to 2d2cec1 Compare October 26, 2026 02:37
@ghost
ghost force-pushed the linus-master_base branch from 3b53a63 to 5d84576 Compare October 26, 2026 07:01
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: 6b4b543
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 2d2cec1 to ac234e4 Compare October 26, 2026 07:37
@ghost
ghost force-pushed the linus-master_base branch from 5d84576 to 6582ed2 Compare October 26, 2026 18:11
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: fb2c3f4
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from ac234e4 to 90e3331 Compare October 26, 2026 19:04
@ghost
ghost force-pushed the linus-master_base branch from 6582ed2 to b3a1abc Compare October 26, 2026 23:55
@ghost

ghost commented Oct 27, 2026

Copy link
Copy Markdown
Author

Upstream branch: d135ab4
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 90e3331 to 35d65a4 Compare October 27, 2026 00:27
@ghost
ghost force-pushed the linus-master_base branch from b3a1abc to 712496f Compare October 28, 2026 23:34
_badblocks_set(), _badblocks_clear() and badblocks_check() intend to
round the start/end of a range to the bb->shift block boundary before
operating on the bad-blocks table. They call rounddown()/roundup() as
bare statements:

	rounddown(s, 1 << bb->shift);
	roundup(next, 1 << bb->shift);
	sectors = next - s;

But rounddown()/roundup() (include/linux/math.h) are value-returning
statement-expression macros; they do not modify their argument in
place. The results were discarded, so s and next/target were never
rounded and "sectors = next - s" collapsed back to the original
length. The whole "if (bb->shift)" block was a no-op, and ranges on
devices with bb->shift > 0 were stored/queried at raw sector
granularity instead of being block-aligned -- exactly the "think a
block is not bad when it is" hazard the _badblocks_clear() comment
warns about.

Assign the rounded values back so the alignment takes effect.

Fixes: 3ea3354 ("badblocks: improve badblocks_check() for multiple ranges handling")
Fixes: db448eb ("badblocks: improve badblocks_clear() for multiple ranges handling")
Fixes: 1726c77 ("badblocks: improve badblocks_set() for multiple ranges handling")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
@ghost

ghost commented Oct 29, 2026

Copy link
Copy Markdown
Author

Upstream branch: c339f40
series: https://patchwork.kernel.org/series/1176508/
version: 1

@ghost
ghost force-pushed the series/1176508=>linus-master branch from 35d65a4 to d9426d5 Compare October 29, 2026 00:07
@ghost

ghost commented Oct 30, 2026

Copy link
Copy Markdown
Author

At least one diff in series https://patchwork.kernel.org/series/1176508/ irrelevant now for [{'archived': False, 'project': 241}] search patterns

@ghost ghost closed this Oct 30, 2026
@ghost
ghost deleted the series/1176508=>linus-master branch November 1, 2026 04:42
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant