From: Jan Kara <jack@suse.cz>
To: linux-fsdevel@vger.kernel.org
Cc: ocfs2-devel@oss.oracle.com, Mark Fasheh <mfasheh@suse.com>,
Joel Becker <jlbec@evilplan.org>,
xfs@oss.sgi.com, Jan Kara <jack@suse.cz>
Subject: [PATCH 3/3] ocfs2: Implement get_next_id()
Date: Thu, 4 Feb 2016 15:28:07 +0100 [thread overview]
Message-ID: <1454596087-6814-4-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1454596087-6814-1-git-send-email-jack@suse.cz>
Implement get_next_id() callback to enable use of Q_GETNEXTQUOTA
quotactl for OCFS2.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ocfs2/ocfs2_trace.h | 2 ++
fs/ocfs2/quota_global.c | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h
index 6cb019b7c6a8..a52a2dbc064e 100644
--- a/fs/ocfs2/ocfs2_trace.h
+++ b/fs/ocfs2/ocfs2_trace.h
@@ -2035,6 +2035,8 @@ DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_release_dquot);
DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_acquire_dquot);
+DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_get_next_id);
+
DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_mark_dquot_dirty);
/* End of trace events for fs/ocfs2/quota_global.c. */
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index fde9ef18cff3..8c903ce08e95 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -860,6 +860,30 @@ out:
return status;
}
+static int ocfs2_get_next_id(struct super_block *sb, struct kqid *qid)
+{
+ int type = qid->type;
+ struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv;
+ int status = 0;
+
+ trace_ocfs2_get_next_id(from_kqid(&init_user_ns, *qid), type);
+ status = ocfs2_lock_global_qf(info, 0);
+ if (status < 0)
+ goto out;
+ status = ocfs2_qinfo_lock(info, 0);
+ if (status < 0)
+ goto out_global;
+ status = qtree_get_next_id(&info->dqi_gi, qid);
+ ocfs2_qinfo_unlock(info, 0);
+out_global:
+ ocfs2_unlock_global_qf(info, 0);
+out:
+ /* Avoid logging ENOENT since it just means there isn't next ID */
+ if (status && status != -ENOENT)
+ mlog_errno(status);
+ return status;
+}
+
static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
{
unsigned long mask = (1 << (DQ_LASTSET_B + QIF_ILIMITS_B)) |
@@ -968,4 +992,5 @@ const struct dquot_operations ocfs2_quota_operations = {
.write_info = ocfs2_write_info,
.alloc_dquot = ocfs2_alloc_dquot,
.destroy_dquot = ocfs2_destroy_dquot,
+ .get_next_id = ocfs2_get_next_id,
};
--
2.6.2
prev parent reply other threads:[~2016-02-04 14:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 14:28 [PATCH 0/3 v2] Q_GETNEXTQUOTA support Jan Kara
2016-02-04 14:28 ` [PATCH 1/3] quota: Add support for ->get_nextdqblk() for VFS quota Jan Kara
2016-02-05 1:05 ` Dave Chinner
2016-02-08 6:15 ` Dave Chinner
2016-02-08 14:27 ` Jan Kara
2016-02-08 14:34 ` Jan Kara
2016-02-19 17:31 ` Eric Sandeen
2016-02-19 18:33 ` Jan Kara
2016-02-19 18:43 ` Eric Sandeen
2016-02-22 8:01 ` Jan Kara
2016-02-04 14:28 ` [PATCH 2/3] quota_v2: Implement get_next_id() for V2 quota format Jan Kara
2016-02-04 14:28 ` Jan Kara [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454596087-6814-4-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=jlbec@evilplan.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).