From: Nathan Scott Date: Fri, 16 Sep 2005 15:20:40 +0000 (+0000) Subject: Issue a quote sync before reporting quota, resolving issue with delayed allocation. X-Git-Tag: v2.7.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=546bedf4707cf354542061577a223a870d7754a4;p=thirdparty%2Fxfsprogs-dev.git Issue a quote sync before reporting quota, resolving issue with delayed allocation. Merge of master-melb:xfs-cmds:23840a by kenmcd. --- diff --git a/include/xqm.h b/include/xqm.h index 5e64bffb5..962f19e9b 100644 --- a/include/xqm.h +++ b/include/xqm.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 1995, 2001, 2004 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 1995, 2001, 2004, 2005 Silicon Graphics, Inc. + * All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License @@ -46,6 +47,7 @@ #define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ #define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ #define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ +#define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */ /* * fs_disk_quota structure: @@ -69,15 +71,15 @@ typedef struct fs_disk_quota { __s32 d_itimer; /* zero if within inode limits */ /* if not, we refuse service */ __s32 d_btimer; /* similar to above; for disk blocks */ - __u16 d_iwarns; /* # warnings issued wrt num inodes */ - __u16 d_bwarns; /* # warnings issued wrt disk blocks */ + __u16 d_iwarns; /* # warnings issued wrt num inodes */ + __u16 d_bwarns; /* # warnings issued wrt disk blocks */ __s32 d_padding2; /* padding2 - for future use */ __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ __u64 d_rtbcount; /* # realtime blocks owned */ __s32 d_rtbtimer; /* similar to above; for RT disk blks */ - __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ - __s16 d_padding3; /* padding3 - for future use */ + __u16 d_rtbwarns; /* # warnings issued wrt RT disk blks */ + __s16 d_padding3; /* padding3 - for future use */ char d_padding4[8]; /* yet more padding */ } fs_disk_quota_t; @@ -87,7 +89,7 @@ typedef struct fs_disk_quota { #define FS_DQ_ISOFT (1<<0) #define FS_DQ_IHARD (1<<1) #define FS_DQ_BSOFT (1<<2) -#define FS_DQ_BHARD (1<<3) +#define FS_DQ_BHARD (1<<3) #define FS_DQ_RTBSOFT (1<<4) #define FS_DQ_RTBHARD (1<<5) #define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ @@ -96,12 +98,12 @@ typedef struct fs_disk_quota { * These timers can only be set in super user's dquot. For others, timers are * automatically started and stopped. Superusers timer values set the limits * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values - * defined below are used. + * defined below are used. * These values also apply only to the d_fieldmask field for Q_XSETQLIM. */ #define FS_DQ_BTIMER (1<<6) #define FS_DQ_ITIMER (1<<7) -#define FS_DQ_RTBTIMER (1<<8) +#define FS_DQ_RTBTIMER (1<<8) #define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) /* @@ -155,9 +157,9 @@ typedef struct fs_quota_stat { fs_qfilestat_t qs_uquota; /* user quota storage information */ fs_qfilestat_t qs_gquota; /* group quota storage information */ __u32 qs_incoredqs; /* number of dquots incore */ - __s32 qs_btimelimit; /* limit for blks timer */ - __s32 qs_itimelimit; /* limit for inodes timer */ - __s32 qs_rtbtimelimit;/* limit for rt blks timer */ + __s32 qs_btimelimit; /* limit for blks timer */ + __s32 qs_itimelimit; /* limit for inodes timer */ + __s32 qs_rtbtimelimit;/* limit for rt blks timer */ __u16 qs_bwarnlimit; /* limit for num warnings */ __u16 qs_iwarnlimit; /* limit for num warnings */ } fs_quota_stat_t; diff --git a/quota/free.c b/quota/free.c index 717bffc7b..4234c8916 100644 --- a/quota/free.c +++ b/quota/free.c @@ -168,6 +168,7 @@ projects_free_space_data( return 0; } + xfsquotactl(XFS_QSYNC, dev, type, projid, NULL); if (xfsquotactl(XFS_GETQUOTA, dev, type, projid, (void *)&d) < 0) { perror("XFS_GETQUOTA"); close(fd); diff --git a/quota/irix.c b/quota/irix.c index f6d7cfc0f..4f4e74679 100644 --- a/quota/irix.c +++ b/quota/irix.c @@ -59,6 +59,8 @@ xcommand_to_qcommand( return Q_XGETQSTAT; case XFS_QUOTARM: return Q_XQUOTARM; + case XFS_QSYNC: + return Q_SYNC; } return 0; } diff --git a/quota/linux.c b/quota/linux.c index 9cbc3fef1..f1383d17d 100644 --- a/quota/linux.c +++ b/quota/linux.c @@ -69,6 +69,8 @@ xcommand_to_qcommand( return Q_XGETQSTAT; case XFS_QUOTARM: return Q_XQUOTARM; + case XFS_QSYNC: + return Q_XQUOTASYNC; } return 0; } diff --git a/quota/quota.c b/quota/quota.c index 8da04def5..6737b9b12 100644 --- a/quota/quota.c +++ b/quota/quota.c @@ -78,6 +78,7 @@ quota_mount( uint qflags; int count; + xfsquotactl(XFS_QSYNC, dev, type, 0, NULL); if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) return 0; diff --git a/quota/quota.h b/quota/quota.h index f84f116a6..d03ed07c3 100644 --- a/quota/quota.h +++ b/quota/quota.h @@ -55,6 +55,7 @@ enum { XFS_SETQLIM, /* set disk limits */ XFS_GETQSTAT, /* get quota subsystem status */ XFS_QUOTARM, /* free disk space used by dquots */ + XFS_QSYNC, /* flush delayed allocate space */ }; /* diff --git a/quota/report.c b/quota/report.c index b0c915497..9244990c1 100644 --- a/quota/report.c +++ b/quota/report.c @@ -521,21 +521,30 @@ report_any_type( if (type & XFS_USER_QUOTA) { fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor); - while ((mount = fs_cursor_next_entry(&cursor))) + while ((mount = fs_cursor_next_entry(&cursor))) { + xfsquotactl(XFS_QSYNC, mount->fs_name, + XFS_USER_QUOTA, 0, NULL); report_user_mount(fp, form, mount, lower, upper, flags); + } } if (type & XFS_GROUP_QUOTA) { fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor); - while ((mount = fs_cursor_next_entry(&cursor))) + while ((mount = fs_cursor_next_entry(&cursor))) { + xfsquotactl(XFS_QSYNC, mount->fs_name, + XFS_GROUP_QUOTA, 0, NULL); report_group_mount(fp, form, mount, lower, upper, flags); + } } if (type & XFS_PROJ_QUOTA) { fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor); - while ((mount = fs_cursor_next_entry(&cursor))) + while ((mount = fs_cursor_next_entry(&cursor))) { + xfsquotactl(XFS_QSYNC, mount->fs_name, + XFS_PROJ_QUOTA, 0, NULL); report_project_mount(fp, form, mount, lower, upper, flags); + } } }