[PATCH, RFC] mkfs: get sector size from host fs dev when mkfs'ing file

Eric Sandeen sandeen at redhat.com
Mon Dec 14 09:35:54 CST 2015


On 12/13/15 7:27 PM, Dave Chinner wrote:
...

> So the current behaviour is to use the underlying filesystem
> sector size, but we might have a 4k fs sector on a 512 physical
> sector device, and you want to detect this, right? The logical
> sector size is exposed by the filesystem in the XFS_IOC_DIOINFO
> information. i.e:
> 
>         case XFS_IOC_DIOINFO: {
>                 struct dioattr  da;
>                 xfs_buftarg_t   *target =
>                         XFS_IS_REALTIME_INODE(ip) ?
>                         mp->m_rtdev_targp : mp->m_ddev_targp;
> 
>                 da.d_mem =  da.d_miniosz = target->bt_logical_sectorsize;
>                 da.d_maxiosz = INT_MAX & ~(da.d_miniosz - 1);
> 
>                 if (copy_to_user(arg, &da, sizeof(da)))
>                         return -EFAULT;
>                 return 0;
>         }
> 
> Isn't this exactly what XFS_IOC_DIOINFO is for?

Oh, right.  SO MANY INTERFACES.  ;)

But sure, that makes more sense, thanks for the reminder.

-Eric



More information about the xfs mailing list