@@ -573,17 +573,28 @@ xfs_stat_blksize(
573
573
}
574
574
575
575
static void
576
- xfs_get_atomic_write_attr (
576
+ xfs_report_dioalign (
577
577
struct xfs_inode * ip ,
578
- unsigned int * unit_min ,
579
- unsigned int * unit_max )
578
+ struct kstat * stat )
580
579
{
581
- if (!xfs_inode_can_atomicwrite (ip )) {
582
- * unit_min = * unit_max = 0 ;
583
- return ;
584
- }
580
+ struct xfs_buftarg * target = xfs_inode_buftarg (ip );
581
+ struct block_device * bdev = target -> bt_bdev ;
585
582
586
- * unit_min = * unit_max = ip -> i_mount -> m_sb .sb_blocksize ;
583
+ stat -> result_mask |= STATX_DIOALIGN ;
584
+ stat -> dio_mem_align = bdev_dma_alignment (bdev ) + 1 ;
585
+ stat -> dio_offset_align = bdev_logical_block_size (bdev );
586
+ }
587
+
588
+ static void
589
+ xfs_report_atomic_write (
590
+ struct xfs_inode * ip ,
591
+ struct kstat * stat )
592
+ {
593
+ unsigned int unit_min = 0 , unit_max = 0 ;
594
+
595
+ if (xfs_inode_can_atomicwrite (ip ))
596
+ unit_min = unit_max = ip -> i_mount -> m_sb .sb_blocksize ;
597
+ generic_fill_statx_atomic_writes (stat , unit_min , unit_max );
587
598
}
588
599
589
600
STATIC int
@@ -647,22 +658,10 @@ xfs_vn_getattr(
647
658
stat -> rdev = inode -> i_rdev ;
648
659
break ;
649
660
case S_IFREG :
650
- if (request_mask & STATX_DIOALIGN ) {
651
- struct xfs_buftarg * target = xfs_inode_buftarg (ip );
652
- struct block_device * bdev = target -> bt_bdev ;
653
-
654
- stat -> result_mask |= STATX_DIOALIGN ;
655
- stat -> dio_mem_align = bdev_dma_alignment (bdev ) + 1 ;
656
- stat -> dio_offset_align = bdev_logical_block_size (bdev );
657
- }
658
- if (request_mask & STATX_WRITE_ATOMIC ) {
659
- unsigned int unit_min , unit_max ;
660
-
661
- xfs_get_atomic_write_attr (ip , & unit_min ,
662
- & unit_max );
663
- generic_fill_statx_atomic_writes (stat ,
664
- unit_min , unit_max );
665
- }
661
+ if (request_mask & STATX_DIOALIGN )
662
+ xfs_report_dioalign (ip , stat );
663
+ if (request_mask & STATX_WRITE_ATOMIC )
664
+ xfs_report_atomic_write (ip , stat );
666
665
fallthrough ;
667
666
default :
668
667
stat -> blksize = xfs_stat_blksize (ip );
0 commit comments