aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/quota_global.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/ocfs2/quota_global.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'fs/ocfs2/quota_global.c')
-rw-r--r--fs/ocfs2/quota_global.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 332a281f217..92fcd575775 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -95,7 +95,7 @@ static void ocfs2_global_mem2diskdqb(void *dp, struct dquot *dquot)
95 struct ocfs2_global_disk_dqblk *d = dp; 95 struct ocfs2_global_disk_dqblk *d = dp;
96 struct mem_dqblk *m = &dquot->dq_dqb; 96 struct mem_dqblk *m = &dquot->dq_dqb;
97 97
98 d->dqb_id = cpu_to_le32(from_kqid(&init_user_ns, dquot->dq_id)); 98 d->dqb_id = cpu_to_le32(dquot->dq_id);
99 d->dqb_use_count = cpu_to_le32(OCFS2_DQUOT(dquot)->dq_use_count); 99 d->dqb_use_count = cpu_to_le32(OCFS2_DQUOT(dquot)->dq_use_count);
100 d->dqb_ihardlimit = cpu_to_le64(m->dqb_ihardlimit); 100 d->dqb_ihardlimit = cpu_to_le64(m->dqb_ihardlimit);
101 d->dqb_isoftlimit = cpu_to_le64(m->dqb_isoftlimit); 101 d->dqb_isoftlimit = cpu_to_le64(m->dqb_isoftlimit);
@@ -112,14 +112,11 @@ static int ocfs2_global_is_id(void *dp, struct dquot *dquot)
112{ 112{
113 struct ocfs2_global_disk_dqblk *d = dp; 113 struct ocfs2_global_disk_dqblk *d = dp;
114 struct ocfs2_mem_dqinfo *oinfo = 114 struct ocfs2_mem_dqinfo *oinfo =
115 sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv; 115 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
116 116
117 if (qtree_entry_unused(&oinfo->dqi_gi, dp)) 117 if (qtree_entry_unused(&oinfo->dqi_gi, dp))
118 return 0; 118 return 0;
119 119 return le32_to_cpu(d->dqb_id) == dquot->dq_id;
120 return qid_eq(make_kqid(&init_user_ns, dquot->dq_id.type,
121 le32_to_cpu(d->dqb_id)),
122 dquot->dq_id);
123} 120}
124 121
125struct qtree_fmt_operations ocfs2_global_ops = { 122struct qtree_fmt_operations ocfs2_global_ops = {
@@ -402,6 +399,8 @@ int ocfs2_global_read_info(struct super_block *sb, int type)
402 msecs_to_jiffies(oinfo->dqi_syncms)); 399 msecs_to_jiffies(oinfo->dqi_syncms));
403 400
404out_err: 401out_err:
402 if (status)
403 mlog_errno(status);
405 return status; 404 return status;
406out_unlock: 405out_unlock:
407 ocfs2_unlock_global_qf(oinfo, 0); 406 ocfs2_unlock_global_qf(oinfo, 0);
@@ -478,7 +477,7 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
478{ 477{
479 int err, err2; 478 int err, err2;
480 struct super_block *sb = dquot->dq_sb; 479 struct super_block *sb = dquot->dq_sb;
481 int type = dquot->dq_id.type; 480 int type = dquot->dq_type;
482 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; 481 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv;
483 struct ocfs2_global_disk_dqblk dqblk; 482 struct ocfs2_global_disk_dqblk dqblk;
484 s64 spacechange, inodechange; 483 s64 spacechange, inodechange;
@@ -507,8 +506,7 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
507 olditime = dquot->dq_dqb.dqb_itime; 506 olditime = dquot->dq_dqb.dqb_itime;
508 oldbtime = dquot->dq_dqb.dqb_btime; 507 oldbtime = dquot->dq_dqb.dqb_btime;
509 ocfs2_global_disk2memdqb(dquot, &dqblk); 508 ocfs2_global_disk2memdqb(dquot, &dqblk);
510 trace_ocfs2_sync_dquot(from_kqid(&init_user_ns, dquot->dq_id), 509 trace_ocfs2_sync_dquot(dquot->dq_id, dquot->dq_dqb.dqb_curspace,
511 dquot->dq_dqb.dqb_curspace,
512 (long long)spacechange, 510 (long long)spacechange,
513 dquot->dq_dqb.dqb_curinodes, 511 dquot->dq_dqb.dqb_curinodes,
514 (long long)inodechange); 512 (long long)inodechange);
@@ -559,8 +557,8 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
559 err = ocfs2_qinfo_lock(info, freeing); 557 err = ocfs2_qinfo_lock(info, freeing);
560 if (err < 0) { 558 if (err < 0) {
561 mlog(ML_ERROR, "Failed to lock quota info, losing quota write" 559 mlog(ML_ERROR, "Failed to lock quota info, losing quota write"
562 " (type=%d, id=%u)\n", dquot->dq_id.type, 560 " (type=%d, id=%u)\n", dquot->dq_type,
563 (unsigned)from_kqid(&init_user_ns, dquot->dq_id)); 561 (unsigned)dquot->dq_id);
564 goto out; 562 goto out;
565 } 563 }
566 if (freeing) 564 if (freeing)
@@ -595,10 +593,9 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type)
595 struct ocfs2_super *osb = OCFS2_SB(sb); 593 struct ocfs2_super *osb = OCFS2_SB(sb);
596 int status = 0; 594 int status = 0;
597 595
598 trace_ocfs2_sync_dquot_helper(from_kqid(&init_user_ns, dquot->dq_id), 596 trace_ocfs2_sync_dquot_helper(dquot->dq_id, dquot->dq_type,
599 dquot->dq_id.type,
600 type, sb->s_id); 597 type, sb->s_id);
601 if (type != dquot->dq_id.type) 598 if (type != dquot->dq_type)
602 goto out; 599 goto out;
603 status = ocfs2_lock_global_qf(oinfo, 1); 600 status = ocfs2_lock_global_qf(oinfo, 1);
604 if (status < 0) 601 if (status < 0)
@@ -648,8 +645,7 @@ static int ocfs2_write_dquot(struct dquot *dquot)
648 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); 645 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
649 int status = 0; 646 int status = 0;
650 647
651 trace_ocfs2_write_dquot(from_kqid(&init_user_ns, dquot->dq_id), 648 trace_ocfs2_write_dquot(dquot->dq_id, dquot->dq_type);
652 dquot->dq_id.type);
653 649
654 handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS); 650 handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS);
655 if (IS_ERR(handle)) { 651 if (IS_ERR(handle)) {
@@ -683,12 +679,11 @@ static int ocfs2_release_dquot(struct dquot *dquot)
683{ 679{
684 handle_t *handle; 680 handle_t *handle;
685 struct ocfs2_mem_dqinfo *oinfo = 681 struct ocfs2_mem_dqinfo *oinfo =
686 sb_dqinfo(dquot->dq_sb, dquot->dq_id.type)->dqi_priv; 682 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
687 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); 683 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
688 int status = 0; 684 int status = 0;
689 685
690 trace_ocfs2_release_dquot(from_kqid(&init_user_ns, dquot->dq_id), 686 trace_ocfs2_release_dquot(dquot->dq_id, dquot->dq_type);
691 dquot->dq_id.type);
692 687
693 mutex_lock(&dquot->dq_lock); 688 mutex_lock(&dquot->dq_lock);
694 /* Check whether we are not racing with some other dqget() */ 689 /* Check whether we are not racing with some other dqget() */
@@ -698,7 +693,7 @@ static int ocfs2_release_dquot(struct dquot *dquot)
698 if (status < 0) 693 if (status < 0)
699 goto out; 694 goto out;
700 handle = ocfs2_start_trans(osb, 695 handle = ocfs2_start_trans(osb,
701 ocfs2_calc_qdel_credits(dquot->dq_sb, dquot->dq_id.type)); 696 ocfs2_calc_qdel_credits(dquot->dq_sb, dquot->dq_type));
702 if (IS_ERR(handle)) { 697 if (IS_ERR(handle)) {
703 status = PTR_ERR(handle); 698 status = PTR_ERR(handle);
704 mlog_errno(status); 699 mlog_errno(status);
@@ -740,14 +735,13 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
740 int ex = 0; 735 int ex = 0;
741 struct super_block *sb = dquot->dq_sb; 736 struct super_block *sb = dquot->dq_sb;
742 struct ocfs2_super *osb = OCFS2_SB(sb); 737 struct ocfs2_super *osb = OCFS2_SB(sb);
743 int type = dquot->dq_id.type; 738 int type = dquot->dq_type;
744 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; 739 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv;
745 struct inode *gqinode = info->dqi_gqinode; 740 struct inode *gqinode = info->dqi_gqinode;
746 int need_alloc = ocfs2_global_qinit_alloc(sb, type); 741 int need_alloc = ocfs2_global_qinit_alloc(sb, type);
747 handle_t *handle; 742 handle_t *handle;
748 743
749 trace_ocfs2_acquire_dquot(from_kqid(&init_user_ns, dquot->dq_id), 744 trace_ocfs2_acquire_dquot(dquot->dq_id, type);
750 type);
751 mutex_lock(&dquot->dq_lock); 745 mutex_lock(&dquot->dq_lock);
752 /* 746 /*
753 * We need an exclusive lock, because we're going to update use count 747 * We need an exclusive lock, because we're going to update use count
@@ -829,13 +823,12 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
829 int sync = 0; 823 int sync = 0;
830 int status; 824 int status;
831 struct super_block *sb = dquot->dq_sb; 825 struct super_block *sb = dquot->dq_sb;
832 int type = dquot->dq_id.type; 826 int type = dquot->dq_type;
833 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; 827 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
834 handle_t *handle; 828 handle_t *handle;
835 struct ocfs2_super *osb = OCFS2_SB(sb); 829 struct ocfs2_super *osb = OCFS2_SB(sb);
836 830
837 trace_ocfs2_mark_dquot_dirty(from_kqid(&init_user_ns, dquot->dq_id), 831 trace_ocfs2_mark_dquot_dirty(dquot->dq_id, type);
838 type);
839 832
840 /* In case user set some limits, sync dquot immediately to global 833 /* In case user set some limits, sync dquot immediately to global
841 * quota file so that information propagates quicker */ 834 * quota file so that information propagates quicker */