Commit 823f57cd authored by Jon Krueger's avatar Jon Krueger Committed by Nathan Scott

[XFS] Add support for allocating additional file space in

stripe width sized chunks. A new fstab/mount option,
"swalloc" has been defined. If specified when mounting
a striped file system, allocation requests will be
rounded up to a stripe width if the file size is >= stripe
width, and the data is being appended to eof. The
'swalloc' option is "off" by default.

SGI Modid: xfs-linux:xfs-kern:171710a
parent d2637378
...@@ -100,5 +100,7 @@ struct xfs_mount_args { ...@@ -100,5 +100,7 @@ struct xfs_mount_args {
#define XFSMNT_DMAPI 0x02000000 /* enable dmapi/xdsm */ #define XFSMNT_DMAPI 0x02000000 /* enable dmapi/xdsm */
#define XFSMNT_NOLOGFLUSH 0x04000000 /* Don't flush for log blocks */ #define XFSMNT_NOLOGFLUSH 0x04000000 /* Don't flush for log blocks */
#define XFSMNT_IDELETE 0x08000000 /* inode cluster delete */ #define XFSMNT_IDELETE 0x08000000 /* inode cluster delete */
#define XFSMNT_SWALLOC 0x10000000 /* turn on stripe width
* allocation */
#endif /* __XFS_CLNT_H__ */ #endif /* __XFS_CLNT_H__ */
...@@ -616,12 +616,31 @@ xfs_iomap_write_delay( ...@@ -616,12 +616,31 @@ xfs_iomap_write_delay(
nimaps = XFS_WRITE_IMAPS; nimaps = XFS_WRITE_IMAPS;
firstblock = NULLFSBLOCK; firstblock = NULLFSBLOCK;
/*
* If mounted with the "-o swalloc" option, roundup the allocation
* request to a stripe width boundary if the file size is >=
* stripe width and we are allocating past the allocation eof.
*/
if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC)
&& (isize >= XFS_FSB_TO_B(mp, mp->m_swidth)) && aeof) {
int eof;
xfs_fileoff_t new_last_fsb;
new_last_fsb = roundup_64(last_fsb, mp->m_swidth);
error = xfs_bmap_eof(ip, new_last_fsb, XFS_DATA_FORK, &eof);
if (error) {
return error;
}
if (eof) {
last_fsb = new_last_fsb;
}
/* /*
* Roundup the allocation request to a stripe unit (m_dalign) boundary * Roundup the allocation request to a stripe unit (m_dalign) boundary
* if the file size is >= stripe unit size, and we are allocating past * if the file size is >= stripe unit size, and we are allocating past
* the allocation eof. * the allocation eof.
*/ */
if (mp->m_dalign && (isize >= XFS_FSB_TO_B(mp, mp->m_dalign)) && aeof) { } else if (mp->m_dalign && (isize >= XFS_FSB_TO_B(mp, mp->m_dalign))
&& aeof) {
int eof; int eof;
xfs_fileoff_t new_last_fsb; xfs_fileoff_t new_last_fsb;
new_last_fsb = roundup_64(last_fsb, mp->m_dalign); new_last_fsb = roundup_64(last_fsb, mp->m_dalign);
......
...@@ -682,14 +682,21 @@ xfs_mountfs( ...@@ -682,14 +682,21 @@ xfs_mountfs(
error = XFS_ERROR(EINVAL); error = XFS_ERROR(EINVAL);
goto error1; goto error1;
} }
xfs_fs_cmn_err(CE_WARN, mp,
"stripe alignment turned off: sunit(%d)/swidth(%d) incompatible with agsize(%d)",
mp->m_dalign, mp->m_swidth,
sbp->sb_agblocks);
mp->m_dalign = 0; mp->m_dalign = 0;
mp->m_swidth = 0; mp->m_swidth = 0;
} else if (mp->m_dalign) { } else if (mp->m_dalign) {
mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
} else { } else {
if (mp->m_flags & XFS_MOUNT_RETERR) { if (mp->m_flags & XFS_MOUNT_RETERR) {
cmn_err(CE_WARN, xfs_fs_cmn_err(CE_WARN, mp,
"XFS: alignment check 3 failed"); "stripe alignment turned off: sunit(%d) less than bsize(%d)",
mp->m_dalign,
mp->m_blockmask +1);
error = XFS_ERROR(EINVAL); error = XFS_ERROR(EINVAL);
goto error1; goto error1;
} }
......
...@@ -416,6 +416,8 @@ typedef struct xfs_mount { ...@@ -416,6 +416,8 @@ typedef struct xfs_mount {
#define XFS_MOUNT_NOUUID 0x00010000 /* ignore uuid during mount */ #define XFS_MOUNT_NOUUID 0x00010000 /* ignore uuid during mount */
#define XFS_MOUNT_NOLOGFLUSH 0x00020000 #define XFS_MOUNT_NOLOGFLUSH 0x00020000
#define XFS_MOUNT_IDELETE 0x00040000 /* delete empty inode clusters*/ #define XFS_MOUNT_IDELETE 0x00040000 /* delete empty inode clusters*/
#define XFS_MOUNT_SWALLOC 0x00080000 /* turn on stripe width
* allocation */
/* /*
* Default minimum read and write sizes. * Default minimum read and write sizes.
......
...@@ -279,6 +279,9 @@ xfs_start_flags( ...@@ -279,6 +279,9 @@ xfs_start_flags(
if (ap->flags & XFSMNT_NOALIGN) if (ap->flags & XFSMNT_NOALIGN)
mp->m_flags |= XFS_MOUNT_NOALIGN; mp->m_flags |= XFS_MOUNT_NOALIGN;
if (ap->flags & XFSMNT_SWALLOC)
mp->m_flags |= XFS_MOUNT_SWALLOC;
if (ap->flags & XFSMNT_OSYNCISOSYNC) if (ap->flags & XFSMNT_OSYNCISOSYNC)
mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC; mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC;
...@@ -1614,6 +1617,7 @@ xfs_vget( ...@@ -1614,6 +1617,7 @@ xfs_vget(
#define MNTOPT_WSYNC "wsync" /* safe-mode nfs compatible mount */ #define MNTOPT_WSYNC "wsync" /* safe-mode nfs compatible mount */
#define MNTOPT_INO64 "ino64" /* force inodes into 64-bit range */ #define MNTOPT_INO64 "ino64" /* force inodes into 64-bit range */
#define MNTOPT_NOALIGN "noalign" /* turn off stripe alignment */ #define MNTOPT_NOALIGN "noalign" /* turn off stripe alignment */
#define MNTOPT_SWALLOC "swalloc" /* turn on stripe width allocation */
#define MNTOPT_SUNIT "sunit" /* data volume stripe unit */ #define MNTOPT_SUNIT "sunit" /* data volume stripe unit */
#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */ #define MNTOPT_SWIDTH "swidth" /* data volume stripe width */
#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */ #define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */
...@@ -1721,6 +1725,8 @@ xfs_parseargs( ...@@ -1721,6 +1725,8 @@ xfs_parseargs(
#endif #endif
} else if (!strcmp(this_char, MNTOPT_NOALIGN)) { } else if (!strcmp(this_char, MNTOPT_NOALIGN)) {
args->flags |= XFSMNT_NOALIGN; args->flags |= XFSMNT_NOALIGN;
} else if (!strcmp(this_char, MNTOPT_SWALLOC)) {
args->flags |= XFSMNT_SWALLOC;
} else if (!strcmp(this_char, MNTOPT_SUNIT)) { } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
if (!value || !*value) { if (!value || !*value) {
printk("XFS: %s option requires an argument\n", printk("XFS: %s option requires an argument\n",
...@@ -1815,6 +1821,7 @@ xfs_showargs( ...@@ -1815,6 +1821,7 @@ xfs_showargs(
{ XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC }, { XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC },
{ XFS_MOUNT_INO64, "," MNTOPT_INO64 }, { XFS_MOUNT_INO64, "," MNTOPT_INO64 },
{ XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN }, { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN },
{ XFS_MOUNT_SWALLOC, "," MNTOPT_SWALLOC },
{ XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID }, { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
{ XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY }, { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY },
{ XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC }, { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment