@@ -258,7 +258,7 @@ static int blk_validate_limits(struct queue_limits *lim)
258258
259259 if (lim -> alignment_offset ) {
260260 lim -> alignment_offset &= (lim -> physical_block_size - 1 );
261- lim -> misaligned = 0 ;
261+ lim -> features &= ~ BLK_FEAT_MISALIGNED ;
262262 }
263263
264264 if (!(lim -> features & BLK_FEAT_WRITE_CACHE ))
@@ -470,6 +470,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
470470 if (!(b -> features & BLK_FEAT_POLL ))
471471 t -> features &= ~BLK_FEAT_POLL ;
472472
473+ t -> flags |= (b -> flags & BLK_FEAT_MISALIGNED );
474+
473475 t -> max_sectors = min_not_zero (t -> max_sectors , b -> max_sectors );
474476 t -> max_user_sectors = min_not_zero (t -> max_user_sectors ,
475477 b -> max_user_sectors );
@@ -494,8 +496,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
494496 t -> max_segment_size = min_not_zero (t -> max_segment_size ,
495497 b -> max_segment_size );
496498
497- t -> misaligned |= b -> misaligned ;
498-
499499 alignment = queue_limit_alignment_offset (b , start );
500500
501501 /* Bottom device has different alignment. Check that it is
@@ -509,7 +509,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
509509
510510 /* Verify that top and bottom intervals line up */
511511 if (max (top , bottom ) % min (top , bottom )) {
512- t -> misaligned = 1 ;
512+ t -> flags |= BLK_FEAT_MISALIGNED ;
513513 ret = -1 ;
514514 }
515515 }
@@ -531,28 +531,28 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
531531 /* Physical block size a multiple of the logical block size? */
532532 if (t -> physical_block_size & (t -> logical_block_size - 1 )) {
533533 t -> physical_block_size = t -> logical_block_size ;
534- t -> misaligned = 1 ;
534+ t -> flags |= BLK_FEAT_MISALIGNED ;
535535 ret = -1 ;
536536 }
537537
538538 /* Minimum I/O a multiple of the physical block size? */
539539 if (t -> io_min & (t -> physical_block_size - 1 )) {
540540 t -> io_min = t -> physical_block_size ;
541- t -> misaligned = 1 ;
541+ t -> flags |= BLK_FEAT_MISALIGNED ;
542542 ret = -1 ;
543543 }
544544
545545 /* Optimal I/O a multiple of the physical block size? */
546546 if (t -> io_opt & (t -> physical_block_size - 1 )) {
547547 t -> io_opt = 0 ;
548- t -> misaligned = 1 ;
548+ t -> flags |= BLK_FEAT_MISALIGNED ;
549549 ret = -1 ;
550550 }
551551
552552 /* chunk_sectors a multiple of the physical block size? */
553553 if ((t -> chunk_sectors << 9 ) & (t -> physical_block_size - 1 )) {
554554 t -> chunk_sectors = 0 ;
555- t -> misaligned = 1 ;
555+ t -> flags |= BLK_FEAT_MISALIGNED ;
556556 ret = -1 ;
557557 }
558558
@@ -566,7 +566,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
566566
567567 /* Verify that new alignment_offset is on a logical block boundary */
568568 if (t -> alignment_offset & (t -> logical_block_size - 1 )) {
569- t -> misaligned = 1 ;
569+ t -> flags |= BLK_FEAT_MISALIGNED ;
570570 ret = -1 ;
571571 }
572572
@@ -729,7 +729,7 @@ int bdev_alignment_offset(struct block_device *bdev)
729729{
730730 struct request_queue * q = bdev_get_queue (bdev );
731731
732- if (q -> limits .misaligned )
732+ if (q -> limits .flags & BLK_FEAT_MISALIGNED )
733733 return -1 ;
734734 if (bdev_is_partition (bdev ))
735735 return queue_limit_alignment_offset (& q -> limits ,
0 commit comments