Commit 40b52225 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong
Browse files

xfs: remove support for disabling quota accounting on a mounted file system



Disabling quota accounting is hairy, racy code with all kinds of pitfalls.
And it has a very strange mind set, as quota accounting (unlike
enforcement) really is a propery of the on-disk format.  There is no good
use case for supporting this.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent c500bee1
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
@@ -798,29 +798,6 @@ xfs_calc_qm_dqalloc_reservation(
			XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1);
}

/*
 * Turning off quotas.
 *    the quota off logitems: sizeof(struct xfs_qoff_logitem) * 2
 *    the superblock for the quota flags: sector size
 */
STATIC uint
xfs_calc_qm_quotaoff_reservation(
	struct xfs_mount	*mp)
{
	return sizeof(struct xfs_qoff_logitem) * 2 +
		xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
}

/*
 * End of turning off quotas.
 *    the quota off logitems: sizeof(struct xfs_qoff_logitem) * 2
 */
STATIC uint
xfs_calc_qm_quotaoff_end_reservation(void)
{
	return sizeof(struct xfs_qoff_logitem) * 2;
}

/*
 * Syncing the incore super block changes to disk.
 *     the super block to reflect the changes: sector size
@@ -923,13 +900,6 @@ xfs_trans_resv_calc(
	resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation();
	resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT;

	resp->tr_qm_quotaoff.tr_logres = xfs_calc_qm_quotaoff_reservation(mp);
	resp->tr_qm_quotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;

	resp->tr_qm_equotaoff.tr_logres =
		xfs_calc_qm_quotaoff_end_reservation();
	resp->tr_qm_equotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;

	resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp);
	resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT;

+0 −2
Original line number Diff line number Diff line
@@ -46,8 +46,6 @@ struct xfs_trans_resv {
	struct xfs_trans_res	tr_growrtfree;	/* grow realtime freeing */
	struct xfs_trans_res	tr_qm_setqlim;	/* adjust quota limits */
	struct xfs_trans_res	tr_qm_dqalloc;	/* allocate quota on disk */
	struct xfs_trans_res	tr_qm_quotaoff;	/* turn quota off */
	struct xfs_trans_res	tr_qm_equotaoff;/* end of turn quota off */
	struct xfs_trans_res	tr_sb;		/* modify superblock */
	struct xfs_trans_res	tr_fsyncts;	/* update timestamps on fsync */
};
+0 −134
Original line number Diff line number Diff line
@@ -218,137 +218,3 @@ xfs_qm_dquot_logitem_init(
					&xfs_dquot_item_ops);
	lp->qli_dquot = dqp;
}

/*------------------  QUOTAOFF LOG ITEMS  -------------------*/

static inline struct xfs_qoff_logitem *QOFF_ITEM(struct xfs_log_item *lip)
{
	return container_of(lip, struct xfs_qoff_logitem, qql_item);
}


/*
 * This returns the number of iovecs needed to log the given quotaoff item.
 * We only need 1 iovec for an quotaoff item.  It just logs the
 * quotaoff_log_format structure.
 */
STATIC void
xfs_qm_qoff_logitem_size(
	struct xfs_log_item	*lip,
	int			*nvecs,
	int			*nbytes)
{
	*nvecs += 1;
	*nbytes += sizeof(struct xfs_qoff_logitem);
}

STATIC void
xfs_qm_qoff_logitem_format(
	struct xfs_log_item	*lip,
	struct xfs_log_vec	*lv)
{
	struct xfs_qoff_logitem	*qflip = QOFF_ITEM(lip);
	struct xfs_log_iovec	*vecp = NULL;
	struct xfs_qoff_logformat *qlf;

	qlf = xlog_prepare_iovec(lv, &vecp, XLOG_REG_TYPE_QUOTAOFF);
	qlf->qf_type = XFS_LI_QUOTAOFF;
	qlf->qf_size = 1;
	qlf->qf_flags = qflip->qql_flags;
	xlog_finish_iovec(lv, vecp, sizeof(struct xfs_qoff_logitem));
}

/*
 * There isn't much you can do to push a quotaoff item.  It is simply
 * stuck waiting for the log to be flushed to disk.
 */
STATIC uint
xfs_qm_qoff_logitem_push(
	struct xfs_log_item	*lip,
	struct list_head	*buffer_list)
{
	return XFS_ITEM_LOCKED;
}

STATIC xfs_lsn_t
xfs_qm_qoffend_logitem_committed(
	struct xfs_log_item	*lip,
	xfs_lsn_t		lsn)
{
	struct xfs_qoff_logitem	*qfe = QOFF_ITEM(lip);
	struct xfs_qoff_logitem	*qfs = qfe->qql_start_lip;

	xfs_qm_qoff_logitem_relse(qfs);

	kmem_free(lip->li_lv_shadow);
	kmem_free(qfe);
	return (xfs_lsn_t)-1;
}

STATIC void
xfs_qm_qoff_logitem_release(
	struct xfs_log_item	*lip)
{
	struct xfs_qoff_logitem	*qoff = QOFF_ITEM(lip);

	if (test_bit(XFS_LI_ABORTED, &lip->li_flags)) {
		if (qoff->qql_start_lip)
			xfs_qm_qoff_logitem_relse(qoff->qql_start_lip);
		xfs_qm_qoff_logitem_relse(qoff);
	}
}

static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
	.iop_size	= xfs_qm_qoff_logitem_size,
	.iop_format	= xfs_qm_qoff_logitem_format,
	.iop_committed	= xfs_qm_qoffend_logitem_committed,
	.iop_push	= xfs_qm_qoff_logitem_push,
	.iop_release	= xfs_qm_qoff_logitem_release,
};

static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = {
	.iop_size	= xfs_qm_qoff_logitem_size,
	.iop_format	= xfs_qm_qoff_logitem_format,
	.iop_push	= xfs_qm_qoff_logitem_push,
	.iop_release	= xfs_qm_qoff_logitem_release,
};

/*
 * Delete the quotaoff intent from the AIL and free it. On success,
 * this should only be called for the start item. It can be used for
 * either on shutdown or abort.
 */
void
xfs_qm_qoff_logitem_relse(
	struct xfs_qoff_logitem	*qoff)
{
	struct xfs_log_item	*lip = &qoff->qql_item;

	ASSERT(test_bit(XFS_LI_IN_AIL, &lip->li_flags) ||
	       test_bit(XFS_LI_ABORTED, &lip->li_flags) ||
	       XFS_FORCED_SHUTDOWN(lip->li_mountp));
	xfs_trans_ail_delete(lip, 0);
	kmem_free(lip->li_lv_shadow);
	kmem_free(qoff);
}

/*
 * Allocate and initialize an quotaoff item of the correct quota type(s).
 */
struct xfs_qoff_logitem *
xfs_qm_qoff_logitem_init(
	struct xfs_mount	*mp,
	struct xfs_qoff_logitem	*start,
	uint			flags)
{
	struct xfs_qoff_logitem	*qf;

	qf = kmem_zalloc(sizeof(struct xfs_qoff_logitem), 0);

	xfs_log_item_init(mp, &qf->qql_item, XFS_LI_QUOTAOFF, start ?
			&xfs_qm_qoffend_logitem_ops : &xfs_qm_qoff_logitem_ops);
	qf->qql_item.li_mountp = mp;
	qf->qql_start_lip = start;
	qf->qql_flags = flags;
	return qf;
}
+0 −17
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
struct xfs_dquot;
struct xfs_trans;
struct xfs_mount;
struct xfs_qoff_logitem;

struct xfs_dq_logitem {
	struct xfs_log_item	qli_item;	/* common portion */
@@ -17,22 +16,6 @@ struct xfs_dq_logitem {
	xfs_lsn_t		qli_flush_lsn;	/* lsn at last flush */
};

struct xfs_qoff_logitem {
	struct xfs_log_item	qql_item;	/* common portion */
	struct xfs_qoff_logitem *qql_start_lip;	/* qoff-start logitem, if any */
	unsigned int		qql_flags;
};


void xfs_qm_dquot_logitem_init(struct xfs_dquot *dqp);
struct xfs_qoff_logitem	*xfs_qm_qoff_logitem_init(struct xfs_mount *mp,
		struct xfs_qoff_logitem *start,
		uint flags);
void xfs_qm_qoff_logitem_relse(struct xfs_qoff_logitem *);
struct xfs_qoff_logitem	*xfs_trans_get_qoff_item(struct xfs_trans *tp,
		struct xfs_qoff_logitem *startqoff,
		uint flags);
void xfs_trans_log_quotaoff_item(struct xfs_trans *tp,
		struct xfs_qoff_logitem *qlp);

#endif	/* __XFS_DQUOT_ITEM_H__ */
+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ xfs_qm_dqpurge(
/*
 * Purge the dquot cache.
 */
void
static void
xfs_qm_dqpurge_all(
	struct xfs_mount	*mp,
	uint			flags)
Loading