aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/quota.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-01-30 13:34:10 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-01-30 13:34:10 -0500
commitf42faf4fa4eaf7e108dd60f3f2ca5c6e9b45352c (patch)
tree23bf95db3b941a4b14f8b90f98a8aaa663ed6c81 /fs/gfs2/quota.c
parentfd2ee6bb1ef02dfe1f1e1f5b44322e0854596e9a (diff)
[GFS2] Add gfs2_internal_read()
Add the new external read function. Its temporarily in jdata.c even though the protoype is in ops_file.h - this will change shortly. The current implementation will change to a page cache one when that happens. In order to effect the above changes, the various internal inodes now have Linux inodes attached to them. We keep the references to the Linux inodes, rather than the gfs2_inodes in the super block. In order to get everything to work correctly I've had to reorder the init sequence on mount (which I should probably have done earlier when .gfs2_admin was made visible). Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r--fs/gfs2/quota.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 5fb5a5305e0e..69e8f4e92e57 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -56,6 +56,7 @@
56#include "rgrp.h" 56#include "rgrp.h"
57#include "super.h" 57#include "super.h"
58#include "trans.h" 58#include "trans.h"
59#include "ops_file.h"
59 60
60#define QUOTA_USER 1 61#define QUOTA_USER 1
61#define QUOTA_GROUP 0 62#define QUOTA_GROUP 0
@@ -241,7 +242,7 @@ static void slot_put(struct gfs2_quota_data *qd)
241static int bh_get(struct gfs2_quota_data *qd) 242static int bh_get(struct gfs2_quota_data *qd)
242{ 243{
243 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 244 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
244 struct gfs2_inode *ip = sdp->sd_qc_inode; 245 struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
245 unsigned int block, offset; 246 unsigned int block, offset;
246 uint64_t dblock; 247 uint64_t dblock;
247 int new = 0; 248 int new = 0;
@@ -522,7 +523,7 @@ static int sort_qd(const void *a, const void *b)
522static void do_qc(struct gfs2_quota_data *qd, int64_t change) 523static void do_qc(struct gfs2_quota_data *qd, int64_t change)
523{ 524{
524 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 525 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
525 struct gfs2_inode *ip = sdp->sd_qc_inode; 526 struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
526 struct gfs2_quota_change *qc = qd->qd_bh_qc; 527 struct gfs2_quota_change *qc = qd->qd_bh_qc;
527 int64_t x; 528 int64_t x;
528 529
@@ -563,12 +564,13 @@ static void do_qc(struct gfs2_quota_data *qd, int64_t change)
563static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) 564static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
564{ 565{
565 struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd; 566 struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd;
566 struct gfs2_inode *ip = sdp->sd_quota_inode; 567 struct gfs2_inode *ip = get_v2ip(sdp->sd_quota_inode);
567 unsigned int data_blocks, ind_blocks; 568 unsigned int data_blocks, ind_blocks;
569 struct file_ra_state ra_state;
568 struct gfs2_holder *ghs, i_gh; 570 struct gfs2_holder *ghs, i_gh;
569 unsigned int qx, x; 571 unsigned int qx, x;
570 struct gfs2_quota_data *qd; 572 struct gfs2_quota_data *qd;
571 uint64_t offset; 573 loff_t offset;
572 unsigned int nalloc = 0; 574 unsigned int nalloc = 0;
573 struct gfs2_alloc *al = NULL; 575 struct gfs2_alloc *al = NULL;
574 int error; 576 int error;
@@ -631,6 +633,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
631 goto out_gunlock; 633 goto out_gunlock;
632 } 634 }
633 635
636 file_ra_state_init(&ra_state, ip->i_vnode->i_mapping);
634 for (x = 0; x < num_qd; x++) { 637 for (x = 0; x < num_qd; x++) {
635 char buf[sizeof(struct gfs2_quota)]; 638 char buf[sizeof(struct gfs2_quota)];
636 struct gfs2_quota q; 639 struct gfs2_quota q;
@@ -642,7 +645,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
642 sizeof(struct gfs2_quota) bytes. */ 645 sizeof(struct gfs2_quota) bytes. */
643 memset(buf, 0, sizeof(struct gfs2_quota)); 646 memset(buf, 0, sizeof(struct gfs2_quota));
644 647
645 error = gfs2_jdata_read_mem(ip, buf, offset, 648 error = gfs2_internal_read(ip, &ra_state, buf, &offset,
646 sizeof(struct gfs2_quota)); 649 sizeof(struct gfs2_quota));
647 if (error < 0) 650 if (error < 0)
648 goto out_end_trans; 651 goto out_end_trans;
@@ -703,8 +706,10 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
703 struct gfs2_holder i_gh; 706 struct gfs2_holder i_gh;
704 struct gfs2_quota q; 707 struct gfs2_quota q;
705 char buf[sizeof(struct gfs2_quota)]; 708 char buf[sizeof(struct gfs2_quota)];
709 struct file_ra_state ra_state;
706 int error; 710 int error;
707 711
712 file_ra_state_init(&ra_state, sdp->sd_quota_inode->i_mapping);
708 restart: 713 restart:
709 error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh); 714 error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh);
710 if (error) 715 if (error)
@@ -713,6 +718,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
713 gfs2_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb); 718 gfs2_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb);
714 719
715 if (force_refresh || qd->qd_qb.qb_magic != GFS2_MAGIC) { 720 if (force_refresh || qd->qd_qb.qb_magic != GFS2_MAGIC) {
721 loff_t pos;
716 gfs2_glock_dq_uninit(q_gh); 722 gfs2_glock_dq_uninit(q_gh);
717 error = gfs2_glock_nq_init(qd->qd_gl, 723 error = gfs2_glock_nq_init(qd->qd_gl,
718 LM_ST_EXCLUSIVE, GL_NOCACHE, 724 LM_ST_EXCLUSIVE, GL_NOCACHE,
@@ -720,16 +726,17 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
720 if (error) 726 if (error)
721 return error; 727 return error;
722 728
723 error = gfs2_glock_nq_init(sdp->sd_quota_inode->i_gl, 729 error = gfs2_glock_nq_init(get_v2ip(sdp->sd_quota_inode)->i_gl,
724 LM_ST_SHARED, 0, 730 LM_ST_SHARED, 0,
725 &i_gh); 731 &i_gh);
726 if (error) 732 if (error)
727 goto fail; 733 goto fail;
728 734
729 memset(buf, 0, sizeof(struct gfs2_quota)); 735 memset(buf, 0, sizeof(struct gfs2_quota));
730 736 pos = qd2offset(qd);
731 error = gfs2_jdata_read_mem(sdp->sd_quota_inode, buf, 737 error = gfs2_internal_read(get_v2ip(sdp->sd_quota_inode),
732 qd2offset(qd), 738 &ra_state, buf,
739 &pos,
733 sizeof(struct gfs2_quota)); 740 sizeof(struct gfs2_quota));
734 if (error < 0) 741 if (error < 0)
735 goto fail_gunlock; 742 goto fail_gunlock;
@@ -1059,7 +1066,7 @@ int gfs2_quota_read(struct gfs2_sbd *sdp, int user, uint32_t id,
1059 1066
1060int gfs2_quota_init(struct gfs2_sbd *sdp) 1067int gfs2_quota_init(struct gfs2_sbd *sdp)
1061{ 1068{
1062 struct gfs2_inode *ip = sdp->sd_qc_inode; 1069 struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
1063 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; 1070 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
1064 unsigned int x, slot = 0; 1071 unsigned int x, slot = 0;
1065 unsigned int found = 0; 1072 unsigned int found = 0;