blob: 8c1fdf37ee8f09715dd936897c499573b30b5346 [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Nathan Scott4ce31212005-11-02 14:59:41 +11003 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
4 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include "xfs.h"
7#include "xfs_fs.h"
Darrick J. Wong5467b342019-06-28 19:25:35 -07008#include "xfs_shared.h"
Dave Chinner6ca1c902013-08-12 20:49:26 +10009#include "xfs_format.h"
Dave Chinner239880e2013-10-23 10:50:10 +110010#include "xfs_log_format.h"
11#include "xfs_trans_resv.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include "xfs_mount.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include "xfs_inode.h"
Dave Chinnera4fbe6a2013-10-23 10:51:50 +110014#include "xfs_quota.h"
Dave Chinner239880e2013-10-23 10:50:10 +110015#include "xfs_trans.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include "xfs_buf_item.h"
17#include "xfs_trans_priv.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include "xfs_qm.h"
Dave Chinner239880e2013-10-23 10:50:10 +110019#include "xfs_log.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +100021static inline struct xfs_dq_logitem *DQUOT_ITEM(struct xfs_log_item *lip)
22{
23 return container_of(lip, struct xfs_dq_logitem, qli_item);
24}
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026/*
27 * returns the number of iovecs needed to log the given dquot item.
28 */
Dave Chinner166d1362013-08-12 20:50:04 +100029STATIC void
Linus Torvalds1da177e2005-04-16 15:20:36 -070030xfs_qm_dquot_logitem_size(
Dave Chinner166d1362013-08-12 20:50:04 +100031 struct xfs_log_item *lip,
32 int *nvecs,
33 int *nbytes)
Linus Torvalds1da177e2005-04-16 15:20:36 -070034{
Dave Chinner166d1362013-08-12 20:50:04 +100035 *nvecs += 2;
36 *nbytes += sizeof(struct xfs_dq_logformat) +
37 sizeof(struct xfs_disk_dquot);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
40/*
41 * fills in the vector of log iovecs for the given dquot log item.
42 */
43STATIC void
44xfs_qm_dquot_logitem_format(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +100045 struct xfs_log_item *lip,
Christoph Hellwigbde7cff2013-12-13 11:34:02 +110046 struct xfs_log_vec *lv)
Linus Torvalds1da177e2005-04-16 15:20:36 -070047{
Darrick J. Wong0b0fa1d2020-07-14 10:37:22 -070048 struct xfs_disk_dquot ddq;
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +100049 struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip);
Christoph Hellwigbde7cff2013-12-13 11:34:02 +110050 struct xfs_log_iovec *vecp = NULL;
Christoph Hellwigce8e9622013-12-13 11:34:07 +110051 struct xfs_dq_logformat *qlf;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Christoph Hellwigce8e9622013-12-13 11:34:07 +110053 qlf = xlog_prepare_iovec(lv, &vecp, XLOG_REG_TYPE_QFORMAT);
54 qlf->qlf_type = XFS_LI_DQUOT;
55 qlf->qlf_size = 2;
Darrick J. Wongc51df732020-07-14 10:37:30 -070056 qlf->qlf_id = qlip->qli_dquot->q_id;
Christoph Hellwigce8e9622013-12-13 11:34:07 +110057 qlf->qlf_blkno = qlip->qli_dquot->q_blkno;
58 qlf->qlf_len = 1;
59 qlf->qlf_boffset = qlip->qli_dquot->q_bufoffset;
60 xlog_finish_iovec(lv, vecp, sizeof(struct xfs_dq_logformat));
Christoph Hellwigbde7cff2013-12-13 11:34:02 +110061
Darrick J. Wong0b0fa1d2020-07-14 10:37:22 -070062 xfs_dquot_to_disk(&ddq, qlip->qli_dquot);
63
64 xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_DQUOT, &ddq,
Christoph Hellwigbde7cff2013-12-13 11:34:02 +110065 sizeof(struct xfs_disk_dquot));
Linus Torvalds1da177e2005-04-16 15:20:36 -070066}
67
68/*
69 * Increment the pin count of the given dquot.
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 */
71STATIC void
72xfs_qm_dquot_logitem_pin(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +100073 struct xfs_log_item *lip)
Linus Torvalds1da177e2005-04-16 15:20:36 -070074{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +100075 struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 ASSERT(XFS_DQ_IS_LOCKED(dqp));
Peter Leckied1de8022008-10-30 17:05:18 +110078 atomic_inc(&dqp->q_pincount);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079}
80
81/*
82 * Decrement the pin count of the given dquot, and wake up
83 * anyone in xfs_dqwait_unpin() if the count goes to 0. The
Peter Leckiebc3048e2008-10-30 17:05:04 +110084 * dquot must have been previously pinned with a call to
85 * xfs_qm_dquot_logitem_pin().
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070087STATIC void
88xfs_qm_dquot_logitem_unpin(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +100089 struct xfs_log_item *lip,
Christoph Hellwig9412e312010-06-23 18:11:15 +100090 int remove)
Linus Torvalds1da177e2005-04-16 15:20:36 -070091{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +100092 struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot;
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Peter Leckiebc3048e2008-10-30 17:05:04 +110094 ASSERT(atomic_read(&dqp->q_pincount) > 0);
95 if (atomic_dec_and_test(&dqp->q_pincount))
96 wake_up(&dqp->q_pinwait);
Linus Torvalds1da177e2005-04-16 15:20:36 -070097}
98
Linus Torvalds1da177e2005-04-16 15:20:36 -070099/*
100 * This is called to wait for the given dquot to be unpinned.
101 * Most of these pin/unpin routines are plagiarized from inode code.
102 */
103void
104xfs_qm_dqunpin_wait(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000105 struct xfs_dquot *dqp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 ASSERT(XFS_DQ_IS_LOCKED(dqp));
Peter Leckiebc3048e2008-10-30 17:05:04 +1100108 if (atomic_read(&dqp->q_pincount) == 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
111 /*
112 * Give the log a push so we don't wait here too long.
113 */
Christoph Hellwiga14a3482010-01-19 09:56:46 +0000114 xfs_log_force(dqp->q_mount, 0);
Peter Leckiebc3048e2008-10-30 17:05:04 +1100115 wait_event(dqp->q_pinwait, (atomic_read(&dqp->q_pincount) == 0));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116}
117
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118STATIC uint
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000119xfs_qm_dquot_logitem_push(
120 struct xfs_log_item *lip,
Matthew Wilcox57e80952018-03-07 14:59:39 -0800121 struct list_head *buffer_list)
122 __releases(&lip->li_ailp->ail_lock)
123 __acquires(&lip->li_ailp->ail_lock)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000125 struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot;
Carlos Maiolino373b0582017-11-28 08:54:10 -0800126 struct xfs_buf *bp = lip->li_buf;
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000127 uint rval = XFS_ITEM_SUCCESS;
128 int error;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
Peter Leckiebc3048e2008-10-30 17:05:04 +1100130 if (atomic_read(&dqp->q_pincount) > 0)
Dave Chinnerd808f612010-02-02 10:13:42 +1100131 return XFS_ITEM_PINNED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132
Christoph Hellwig800b4842011-12-06 21:58:14 +0000133 if (!xfs_dqlock_nowait(dqp))
Dave Chinnerd808f612010-02-02 10:13:42 +1100134 return XFS_ITEM_LOCKED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
Christoph Hellwigfe7257f2012-04-23 15:58:37 +1000136 /*
137 * Re-check the pincount now that we stabilized the value by
138 * taking the quota lock.
139 */
140 if (atomic_read(&dqp->q_pincount) > 0) {
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000141 rval = XFS_ITEM_PINNED;
142 goto out_unlock;
Christoph Hellwigfe7257f2012-04-23 15:58:37 +1000143 }
144
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000145 /*
146 * Someone else is already flushing the dquot. Nothing we can do
147 * here but wait for the flush to finish and remove the item from
148 * the AIL.
149 */
David Chinnere1f49cf2008-08-13 16:41:43 +1000150 if (!xfs_dqflock_nowait(dqp)) {
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000151 rval = XFS_ITEM_FLUSHING;
152 goto out_unlock;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 }
154
Matthew Wilcox57e80952018-03-07 14:59:39 -0800155 spin_unlock(&lip->li_ailp->ail_lock);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000156
157 error = xfs_qm_dqflush(dqp, &bp);
Darrick J. Wong609001b2018-05-04 15:30:20 -0700158 if (!error) {
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000159 if (!xfs_buf_delwri_queue(bp, buffer_list))
160 rval = XFS_ITEM_FLUSHING;
161 xfs_buf_relse(bp);
Brian Foster8d3d7e22020-03-27 08:29:45 -0700162 } else if (error == -EAGAIN)
163 rval = XFS_ITEM_LOCKED;
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000164
Matthew Wilcox57e80952018-03-07 14:59:39 -0800165 spin_lock(&lip->li_ailp->ail_lock);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000166out_unlock:
167 xfs_dqunlock(dqp);
168 return rval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169}
170
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171STATIC void
Christoph Hellwigddf92052019-06-28 19:27:32 -0700172xfs_qm_dquot_logitem_release(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000173 struct xfs_log_item *lip)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000175 struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 ASSERT(XFS_DQ_IS_LOCKED(dqp));
178
179 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180 * dquots are never 'held' from getting unlocked at the end of
181 * a transaction. Their locking and unlocking is hidden inside the
182 * transaction layer, within trans_commit. Hence, no LI_HOLD flag
183 * for the logitem.
184 */
185 xfs_dqunlock(dqp);
186}
187
Christoph Hellwigddf92052019-06-28 19:27:32 -0700188STATIC void
189xfs_qm_dquot_logitem_committing(
190 struct xfs_log_item *lip,
191 xfs_lsn_t commit_lsn)
192{
193 return xfs_qm_dquot_logitem_release(lip);
194}
195
Christoph Hellwig272e42b2011-10-28 09:54:24 +0000196static const struct xfs_item_ops xfs_dquot_item_ops = {
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000197 .iop_size = xfs_qm_dquot_logitem_size,
198 .iop_format = xfs_qm_dquot_logitem_format,
199 .iop_pin = xfs_qm_dquot_logitem_pin,
200 .iop_unpin = xfs_qm_dquot_logitem_unpin,
Christoph Hellwigddf92052019-06-28 19:27:32 -0700201 .iop_release = xfs_qm_dquot_logitem_release,
202 .iop_committing = xfs_qm_dquot_logitem_committing,
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000203 .iop_push = xfs_qm_dquot_logitem_push,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204};
205
206/*
207 * Initialize the dquot log item for a newly allocated dquot.
208 * The dquot isn't locked at this point, but it isn't on any of the lists
209 * either, so we don't care.
210 */
211void
212xfs_qm_dquot_logitem_init(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000213 struct xfs_dquot *dqp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000215 struct xfs_dq_logitem *lp = &dqp->q_logitem;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216
Dave Chinner43f5efc2010-03-23 10:10:00 +1100217 xfs_log_item_init(dqp->q_mount, &lp->qli_item, XFS_LI_DQUOT,
218 &xfs_dquot_item_ops);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 lp->qli_dquot = dqp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220}
221
222/*------------------ QUOTAOFF LOG ITEMS -------------------*/
223
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000224static 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230/*
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 */
Dave Chinner166d1362013-08-12 20:50:04 +1000235STATIC void
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000236xfs_qm_qoff_logitem_size(
Dave Chinner166d1362013-08-12 20:50:04 +1000237 struct xfs_log_item *lip,
238 int *nvecs,
239 int *nbytes)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240{
Dave Chinner166d1362013-08-12 20:50:04 +1000241 *nvecs += 1;
242 *nbytes += sizeof(struct xfs_qoff_logitem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243}
244
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245STATIC void
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000246xfs_qm_qoff_logitem_format(
247 struct xfs_log_item *lip,
Christoph Hellwigbde7cff2013-12-13 11:34:02 +1100248 struct xfs_log_vec *lv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000250 struct xfs_qoff_logitem *qflip = QOFF_ITEM(lip);
Christoph Hellwigbde7cff2013-12-13 11:34:02 +1100251 struct xfs_log_iovec *vecp = NULL;
Christoph Hellwigffda4e82013-12-13 11:34:08 +1100252 struct xfs_qoff_logformat *qlf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253
Christoph Hellwigffda4e82013-12-13 11:34:08 +1100254 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));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259}
260
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261/*
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000262 * 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.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265STATIC uint
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000266xfs_qm_qoff_logitem_push(
267 struct xfs_log_item *lip,
268 struct list_head *buffer_list)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269{
270 return XFS_ITEM_LOCKED;
271}
272
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273STATIC xfs_lsn_t
274xfs_qm_qoffend_logitem_committed(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000275 struct xfs_log_item *lip,
276 xfs_lsn_t lsn)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000278 struct xfs_qoff_logitem *qfe = QOFF_ITEM(lip);
279 struct xfs_qoff_logitem *qfs = qfe->qql_start_lip;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280
Brian Foster854f82b2020-03-16 14:26:09 -0700281 xfs_qm_qoff_logitem_relse(qfs);
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000282
Dave Chinnerb1c5ebb2016-07-22 09:52:35 +1000283 kmem_free(lip->li_lv_shadow);
Denys Vlasenkof0e2d932008-05-19 16:31:57 +1000284 kmem_free(qfe);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 return (xfs_lsn_t)-1;
286}
287
Brian Foster8a627142020-03-16 14:26:09 -0700288STATIC void
289xfs_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
Christoph Hellwig272e42b2011-10-28 09:54:24 +0000301static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000302 .iop_size = xfs_qm_qoff_logitem_size,
303 .iop_format = xfs_qm_qoff_logitem_format,
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000304 .iop_committed = xfs_qm_qoffend_logitem_committed,
305 .iop_push = xfs_qm_qoff_logitem_push,
Brian Foster8a627142020-03-16 14:26:09 -0700306 .iop_release = xfs_qm_qoff_logitem_release,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307};
308
Christoph Hellwig272e42b2011-10-28 09:54:24 +0000309static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = {
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000310 .iop_size = xfs_qm_qoff_logitem_size,
311 .iop_format = xfs_qm_qoff_logitem_format,
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000312 .iop_push = xfs_qm_qoff_logitem_push,
Brian Foster8a627142020-03-16 14:26:09 -0700313 .iop_release = xfs_qm_qoff_logitem_release,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314};
315
316/*
Brian Foster854f82b2020-03-16 14:26:09 -0700317 * 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 */
321void
322xfs_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));
Brian Foster2b3cf092020-05-06 13:27:04 -0700330 xfs_trans_ail_delete(lip, 0);
Brian Foster854f82b2020-03-16 14:26:09 -0700331 kmem_free(lip->li_lv_shadow);
332 kmem_free(qoff);
333}
334
335/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 * Allocate and initialize an quotaoff item of the correct quota type(s).
337 */
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000338struct xfs_qoff_logitem *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339xfs_qm_qoff_logitem_init(
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000340 struct xfs_mount *mp,
341 struct xfs_qoff_logitem *start,
342 uint flags)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343{
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000344 struct xfs_qoff_logitem *qf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345
Tetsuo Handa707e0dd2019-08-26 12:06:22 -0700346 qf = kmem_zalloc(sizeof(struct xfs_qoff_logitem), 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347
Dave Chinner43f5efc2010-03-23 10:10:00 +1100348 xfs_log_item_init(mp, &qf->qql_item, XFS_LI_QUOTAOFF, start ?
349 &xfs_qm_qoffend_logitem_ops : &xfs_qm_qoff_logitem_ops);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 qf->qql_item.li_mountp = mp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351 qf->qql_start_lip = start;
Christoph Hellwigffda4e82013-12-13 11:34:08 +1100352 qf->qql_flags = flags;
Christoph Hellwig7bfa31d2010-06-23 18:11:15 +1000353 return qf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354}