Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6ffeb1c

Browse files
snitmaxboe
authored andcommitted
md: change mddev 'chunk_sectors' from int to unsigned
Commite2782f5 ("Revert "dm raid: remove unnecessary discardlimits for raid10"") exposed compiler warnings introduced by commite0910c8 ("dm raid: fix discard limits for raid1 and raid10"):In file included from ./include/linux/kernel.h:14, from ./include/asm-generic/bug.h:20, from ./arch/x86/include/asm/bug.h:93, from ./include/linux/bug.h:5, from ./include/linux/mmdebug.h:5, from ./include/linux/gfp.h:5, from ./include/linux/slab.h:15, from drivers/md/dm-raid.c:8:drivers/md/dm-raid.c: In function ‘raid_io_hints’:./include/linux/minmax.h:18:28: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^~./include/linux/minmax.h:32:4: note: in expansion of macro ‘__typecheck’ (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~./include/linux/minmax.h:42:24: note: in expansion of macro ‘__safe_cmp’ __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~./include/linux/minmax.h:51:19: note: in expansion of macro ‘__careful_cmp’ #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~./include/linux/minmax.h:84:39: note: in expansion of macro ‘min’ __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); }) ^~~drivers/md/dm-raid.c:3739:33: note: in expansion of macro ‘min_not_zero’ limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors, ^~~~~~~~~~~~Fix this by changing the chunk_sectors member of 'struct mddev' fromint to 'unsigned int' to match the type used for the 'chunk_sectors'member of 'struct queue_limits'. Various MD code still uses 'int' butnone of it appears to ever make use of signed int; and storingpositive signed int in unsigned is perfectly safe.Reported-by: Song Liu <songliubraving@fb.com>Fixes:e2782f5 ("Revert "dm raid: remove unnecessary discard limits for raid10"")Fixes:e0910c8 ("dm raid: fix discard limits for raid1 and raid10")Cc: stable@vger,kernel.org #e0910c8 was marked for stable@Signed-off-by: Mike Snitzer <snitzer@redhat.com>Reviewed-by: Song Liu <song@kernel.org>Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent4223a5b commit6ffeb1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎drivers/md/md.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ struct mddev {
311311
intexternal;/* metadata is
312312
* managed externally */
313313
charmetadata_type[17];/* externally set*/
314-
intchunk_sectors;
314+
unsignedintchunk_sectors;
315315
time64_tctime,utime;
316316
intlevel,layout;
317317
charclevel[16];
@@ -339,7 +339,7 @@ struct mddev {
339339
*/
340340
sector_treshape_position;
341341
intdelta_disks,new_level,new_layout;
342-
intnew_chunk_sectors;
342+
unsignedintnew_chunk_sectors;
343343
intreshape_backwards;
344344

345345
structmd_thread*thread;/* management thread */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp