Skip to content

Commit 40b5222

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
1 parent c500bee commit 40b5222

File tree

8 files changed

+13
-454
lines changed

8 files changed

+13
-454
lines changed

fs/xfs/libxfs/xfs_trans_resv.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -798,29 +798,6 @@ xfs_calc_qm_dqalloc_reservation(
798798
XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) - 1);
799799
}
800800

801-
/*
802-
* Turning off quotas.
803-
* the quota off logitems: sizeof(struct xfs_qoff_logitem) * 2
804-
* the superblock for the quota flags: sector size
805-
*/
806-
STATIC uint
807-
xfs_calc_qm_quotaoff_reservation(
808-
struct xfs_mount *mp)
809-
{
810-
return sizeof(struct xfs_qoff_logitem) * 2 +
811-
xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
812-
}
813-
814-
/*
815-
* End of turning off quotas.
816-
* the quota off logitems: sizeof(struct xfs_qoff_logitem) * 2
817-
*/
818-
STATIC uint
819-
xfs_calc_qm_quotaoff_end_reservation(void)
820-
{
821-
return sizeof(struct xfs_qoff_logitem) * 2;
822-
}
823-
824801
/*
825802
* Syncing the incore super block changes to disk.
826803
* the super block to reflect the changes: sector size
@@ -923,13 +900,6 @@ xfs_trans_resv_calc(
923900
resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation();
924901
resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT;
925902

926-
resp->tr_qm_quotaoff.tr_logres = xfs_calc_qm_quotaoff_reservation(mp);
927-
resp->tr_qm_quotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;
928-
929-
resp->tr_qm_equotaoff.tr_logres =
930-
xfs_calc_qm_quotaoff_end_reservation();
931-
resp->tr_qm_equotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT;
932-
933903
resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp);
934904
resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT;
935905

fs/xfs/libxfs/xfs_trans_resv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ struct xfs_trans_resv {
4646
struct xfs_trans_res tr_growrtfree; /* grow realtime freeing */
4747
struct xfs_trans_res tr_qm_setqlim; /* adjust quota limits */
4848
struct xfs_trans_res tr_qm_dqalloc; /* allocate quota on disk */
49-
struct xfs_trans_res tr_qm_quotaoff; /* turn quota off */
50-
struct xfs_trans_res tr_qm_equotaoff;/* end of turn quota off */
5149
struct xfs_trans_res tr_sb; /* modify superblock */
5250
struct xfs_trans_res tr_fsyncts; /* update timestamps on fsync */
5351
};

fs/xfs/xfs_dquot_item.c

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -218,137 +218,3 @@ xfs_qm_dquot_logitem_init(
218218
&xfs_dquot_item_ops);
219219
lp->qli_dquot = dqp;
220220
}
221-
222-
/*------------------ QUOTAOFF LOG ITEMS -------------------*/
223-
224-
static inline struct xfs_qoff_logitem *QOFF_ITEM(struct xfs_log_item *lip)
225-
{
226-
return container_of(lip, struct xfs_qoff_logitem, qql_item);
227-
}
228-
229-
230-
/*
231-
* This returns the number of iovecs needed to log the given quotaoff item.
232-
* We only need 1 iovec for an quotaoff item. It just logs the
233-
* quotaoff_log_format structure.
234-
*/
235-
STATIC void
236-
xfs_qm_qoff_logitem_size(
237-
struct xfs_log_item *lip,
238-
int *nvecs,
239-
int *nbytes)
240-
{
241-
*nvecs += 1;
242-
*nbytes += sizeof(struct xfs_qoff_logitem);
243-
}
244-
245-
STATIC void
246-
xfs_qm_qoff_logitem_format(
247-
struct xfs_log_item *lip,
248-
struct xfs_log_vec *lv)
249-
{
250-
struct xfs_qoff_logitem *qflip = QOFF_ITEM(lip);
251-
struct xfs_log_iovec *vecp = NULL;
252-
struct xfs_qoff_logformat *qlf;
253-
254-
qlf = xlog_prepare_iovec(lv, &vecp, XLOG_REG_TYPE_QUOTAOFF);
255-
qlf->qf_type = XFS_LI_QUOTAOFF;
256-
qlf->qf_size = 1;
257-
qlf->qf_flags = qflip->qql_flags;
258-
xlog_finish_iovec(lv, vecp, sizeof(struct xfs_qoff_logitem));
259-
}
260-
261-
/*
262-
* There isn't much you can do to push a quotaoff item. It is simply
263-
* stuck waiting for the log to be flushed to disk.
264-
*/
265-
STATIC uint
266-
xfs_qm_qoff_logitem_push(
267-
struct xfs_log_item *lip,
268-
struct list_head *buffer_list)
269-
{
270-
return XFS_ITEM_LOCKED;
271-
}
272-
273-
STATIC xfs_lsn_t
274-
xfs_qm_qoffend_logitem_committed(
275-
struct xfs_log_item *lip,
276-
xfs_lsn_t lsn)
277-
{
278-
struct xfs_qoff_logitem *qfe = QOFF_ITEM(lip);
279-
struct xfs_qoff_logitem *qfs = qfe->qql_start_lip;
280-
281-
xfs_qm_qoff_logitem_relse(qfs);
282-
283-
kmem_free(lip->li_lv_shadow);
284-
kmem_free(qfe);
285-
return (xfs_lsn_t)-1;
286-
}
287-
288-
STATIC void
289-
xfs_qm_qoff_logitem_release(
290-
struct xfs_log_item *lip)
291-
{
292-
struct xfs_qoff_logitem *qoff = QOFF_ITEM(lip);
293-
294-
if (test_bit(XFS_LI_ABORTED, &lip->li_flags)) {
295-
if (qoff->qql_start_lip)
296-
xfs_qm_qoff_logitem_relse(qoff->qql_start_lip);
297-
xfs_qm_qoff_logitem_relse(qoff);
298-
}
299-
}
300-
301-
static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
302-
.iop_size = xfs_qm_qoff_logitem_size,
303-
.iop_format = xfs_qm_qoff_logitem_format,
304-
.iop_committed = xfs_qm_qoffend_logitem_committed,
305-
.iop_push = xfs_qm_qoff_logitem_push,
306-
.iop_release = xfs_qm_qoff_logitem_release,
307-
};
308-
309-
static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = {
310-
.iop_size = xfs_qm_qoff_logitem_size,
311-
.iop_format = xfs_qm_qoff_logitem_format,
312-
.iop_push = xfs_qm_qoff_logitem_push,
313-
.iop_release = xfs_qm_qoff_logitem_release,
314-
};
315-
316-
/*
317-
* Delete the quotaoff intent from the AIL and free it. On success,
318-
* this should only be called for the start item. It can be used for
319-
* either on shutdown or abort.
320-
*/
321-
void
322-
xfs_qm_qoff_logitem_relse(
323-
struct xfs_qoff_logitem *qoff)
324-
{
325-
struct xfs_log_item *lip = &qoff->qql_item;
326-
327-
ASSERT(test_bit(XFS_LI_IN_AIL, &lip->li_flags) ||
328-
test_bit(XFS_LI_ABORTED, &lip->li_flags) ||
329-
XFS_FORCED_SHUTDOWN(lip->li_mountp));
330-
xfs_trans_ail_delete(lip, 0);
331-
kmem_free(lip->li_lv_shadow);
332-
kmem_free(qoff);
333-
}
334-
335-
/*
336-
* Allocate and initialize an quotaoff item of the correct quota type(s).
337-
*/
338-
struct xfs_qoff_logitem *
339-
xfs_qm_qoff_logitem_init(
340-
struct xfs_mount *mp,
341-
struct xfs_qoff_logitem *start,
342-
uint flags)
343-
{
344-
struct xfs_qoff_logitem *qf;
345-
346-
qf = kmem_zalloc(sizeof(struct xfs_qoff_logitem), 0);
347-
348-
xfs_log_item_init(mp, &qf->qql_item, XFS_LI_QUOTAOFF, start ?
349-
&xfs_qm_qoffend_logitem_ops : &xfs_qm_qoff_logitem_ops);
350-
qf->qql_item.li_mountp = mp;
351-
qf->qql_start_lip = start;
352-
qf->qql_flags = flags;
353-
return qf;
354-
}

fs/xfs/xfs_dquot_item.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,13 @@
99
struct xfs_dquot;
1010
struct xfs_trans;
1111
struct xfs_mount;
12-
struct xfs_qoff_logitem;
1312

1413
struct xfs_dq_logitem {
1514
struct xfs_log_item qli_item; /* common portion */
1615
struct xfs_dquot *qli_dquot; /* dquot ptr */
1716
xfs_lsn_t qli_flush_lsn; /* lsn at last flush */
1817
};
1918

20-
struct xfs_qoff_logitem {
21-
struct xfs_log_item qql_item; /* common portion */
22-
struct xfs_qoff_logitem *qql_start_lip; /* qoff-start logitem, if any */
23-
unsigned int qql_flags;
24-
};
25-
26-
2719
void xfs_qm_dquot_logitem_init(struct xfs_dquot *dqp);
28-
struct xfs_qoff_logitem *xfs_qm_qoff_logitem_init(struct xfs_mount *mp,
29-
struct xfs_qoff_logitem *start,
30-
uint flags);
31-
void xfs_qm_qoff_logitem_relse(struct xfs_qoff_logitem *);
32-
struct xfs_qoff_logitem *xfs_trans_get_qoff_item(struct xfs_trans *tp,
33-
struct xfs_qoff_logitem *startqoff,
34-
uint flags);
35-
void xfs_trans_log_quotaoff_item(struct xfs_trans *tp,
36-
struct xfs_qoff_logitem *qlp);
3720

3821
#endif /* __XFS_DQUOT_ITEM_H__ */

fs/xfs/xfs_qm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ xfs_qm_dqpurge(
185185
/*
186186
* Purge the dquot cache.
187187
*/
188-
void
188+
static void
189189
xfs_qm_dqpurge_all(
190190
struct xfs_mount *mp,
191191
uint flags)

fs/xfs/xfs_qm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ struct xfs_dquot_acct {
140140

141141
extern void xfs_qm_destroy_quotainfo(struct xfs_mount *);
142142

143-
/* dquot stuff */
144-
extern void xfs_qm_dqpurge_all(struct xfs_mount *, uint);
145-
146143
/* quota ops */
147144
extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint);
148145
extern int xfs_qm_scall_getquota(struct xfs_mount *mp,

0 commit comments

Comments
 (0)