From: Eric Sandeen <sandeen@sandeen.net>
To: xfs@oss.sgi.com
Subject: [PATCH V2] mkfs: get sector size from host fs d_miniosz when mkfs'ing file
Date: Mon, 14 Dec 2015 11:16:14 -0600 [thread overview]
Message-ID: <566EF95E.1050706@sandeen.net> (raw)
In-Reply-To: <5660CD5E.2040209@redhat.com>
Now that we allow logical-sector-sized DIOs even if our xfs
filesystem is set to physical-sector-sized "sectors," we can
allow the creation of filesystem images with block and sector
sizes down to the host device's logical sector size, rather
than the filesystem's sector size.
So in platform_findsizes(), change our query of the filesystem
to an XFS_IOC_DIOINFO query, and use the returned d_miniosz for
sector size in the S_IFREG case.
This allows the creation of i.e. a 2k block sized image on
an xfs filesystem w/ 4k sector size created on a 4k/512
block device, which would otherwise fail today.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
V2: Just use XFS_IOC_DIOINFO to get the minimum DIO size,
thanks Dave.
diff --git a/libxfs/linux.c b/libxfs/linux.c
index 885016a..f6ea1b2 100644
--- a/libxfs/linux.c
+++ b/libxfs/linux.c
@@ -142,18 +142,20 @@ platform_findsizes(char *path, int fd, long long *sz, int *bsz)
progname, path, strerror(errno));
exit(1);
}
+
if ((st.st_mode & S_IFMT) == S_IFREG) {
- struct xfs_fsop_geom_v1 geom = { 0 };
+ struct dioattr da;
*sz = (long long)(st.st_size >> 9);
- if (ioctl(fd, XFS_IOC_FSGEOMETRY_V1, &geom) < 0) {
+
+ if (ioctl(fd, XFS_IOC_DIOINFO, &da) < 0) {
/*
* fall back to BBSIZE; mkfs might fail if there's a
* size mismatch between the image & the host fs...
*/
*bsz = BBSIZE;
} else
- *bsz = geom.sectsize;
+ *bsz = da.d_miniosz;
if (*bsz > max_block_alignment)
max_block_alignment = *bsz;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2015-12-14 17:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 23:16 [PATCH, RFC] mkfs: get sector size from host fs dev when mkfs'ing file Eric Sandeen
2015-12-14 1:27 ` Dave Chinner
2015-12-14 15:35 ` Eric Sandeen
2015-12-14 17:16 ` Eric Sandeen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=566EF95E.1050706@sandeen.net \
--to=sandeen@sandeen.net \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox