@@ -459,6 +459,16 @@ vdev_anyraid_pick_best_mapping(vdev_t *cvd, uint64_t *out_txg,
459459 return (error );
460460}
461461
462+ #ifdef _ZFS_BIG_ENDIAN
463+ static void
464+ byteswap_map_buf (void * buf , uint32_t length )
465+ {
466+ for (size_t i = 0 ; i < length ; i += sizeof (anyraid_map_entry_t )) {
467+ ame_byteswap ((anyraid_map_entry_t * )((char * )buf + i ));
468+ }
469+ }
470+ #endif
471+
462472static int
463473anyraid_open_existing (vdev_t * vd , uint64_t child , uint16_t * * child_capacities )
464474{
@@ -596,8 +606,8 @@ anyraid_open_existing(vdev_t *vd, uint64_t child, uint16_t **child_capacities)
596606#ifdef _ZFS_BIG_ENDIAN
597607 uint32_t length = map_length -
598608 next_map * SPA_MAXBLOCKSIZE ;
599- byteswap_uint32_array (map_buf , length <
600- SPA_MAXBLOCKSIZE ? length : SPA_MAXBLOCKSIZE );
609+ byteswap_map_buf (map_buf , ( uint32_t )( length <
610+ SPA_MAXBLOCKSIZE ? length : SPA_MAXBLOCKSIZE )) ;
601611#endif
602612 }
603613 anyraid_map_entry_t * entry =
@@ -1256,7 +1266,9 @@ map_write_issue(zio_t *zio, vdev_t *vd, uint64_t base_offset,
12561266 int flags )
12571267{
12581268#ifdef _ZFS_BIG_ENDIAN
1259- byteswap_uint32_array (abd , length );
1269+ void * buf = abd_borrow_buf (abd , SPA_MAXBLOCKSIZE );
1270+ byteswap_map_buf (buf , length );
1271+ abd_return_buf (abd , buf , SPA_MAXBLOCKSIZE );
12601272#else
12611273 (void ) length ;
12621274#endif
0 commit comments