aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhijith Das <adas@redhat.com>2007-05-31 18:52:02 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-07-09 03:23:01 -0400
commit1990e917651d58a3c5155d0491431c09e29e385b (patch)
tree6e53188136db71ed9abe8982b457ab2d66f1792a
parent0b7cac0fb0e541a7f54d0ba55b31d829ce3dd899 (diff)
[GFS2] Quotas non-functional - fix another bug
This patch fixes a bug where gfs2 was writing update quota usage information to the wrong location in the quota file. Signed-off-by: Abhijith Das <adas@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/ondisk.c10
-rw-r--r--fs/gfs2/quota.c11
-rw-r--r--include/linux/gfs2_ondisk.h1
3 files changed, 18 insertions, 4 deletions
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c
index cd4cf055c37d..a5b05ea3d4c7 100644
--- a/fs/gfs2/ondisk.c
+++ b/fs/gfs2/ondisk.c
@@ -121,6 +121,16 @@ void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf)
121 qu->qu_value = be64_to_cpu(str->qu_value); 121 qu->qu_value = be64_to_cpu(str->qu_value);
122} 122}
123 123
124void gfs2_quota_out(const struct gfs2_quota_host *qu, void *buf)
125{
126 struct gfs2_quota *str = buf;
127
128 str->qu_limit = cpu_to_be64(qu->qu_limit);
129 str->qu_warn = cpu_to_be64(qu->qu_warn);
130 str->qu_value = cpu_to_be64(qu->qu_value);
131 memset(&str->qu_reserved, 0, sizeof(str->qu_reserved));
132}
133
124void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) 134void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
125{ 135{
126 const struct gfs2_dinode_host *di = &ip->i_di; 136 const struct gfs2_dinode_host *di = &ip->i_di;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index fcd3ee2c5b96..8a58815dea08 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -573,12 +573,13 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
573 struct inode *inode = &ip->i_inode; 573 struct inode *inode = &ip->i_inode;
574 struct address_space *mapping = inode->i_mapping; 574 struct address_space *mapping = inode->i_mapping;
575 unsigned long index = loc >> PAGE_CACHE_SHIFT; 575 unsigned long index = loc >> PAGE_CACHE_SHIFT;
576 unsigned offset = loc & (PAGE_CACHE_SHIFT - 1); 576 unsigned offset = loc & (PAGE_CACHE_SIZE - 1);
577 unsigned blocksize, iblock, pos; 577 unsigned blocksize, iblock, pos;
578 struct buffer_head *bh; 578 struct buffer_head *bh;
579 struct page *page; 579 struct page *page;
580 void *kaddr; 580 void *kaddr;
581 __be64 *ptr; 581 char *ptr;
582 struct gfs2_quota_host qp;
582 s64 value; 583 s64 value;
583 int err = -EIO; 584 int err = -EIO;
584 585
@@ -620,8 +621,10 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
620 621
621 kaddr = kmap_atomic(page, KM_USER0); 622 kaddr = kmap_atomic(page, KM_USER0);
622 ptr = kaddr + offset; 623 ptr = kaddr + offset;
623 value = (s64)be64_to_cpu(*ptr) + change; 624 gfs2_quota_in(&qp, ptr);
624 *ptr = cpu_to_be64(value); 625 qp.qu_value += change;
626 value = qp.qu_value;
627 gfs2_quota_out(&qp, ptr);
625 flush_dcache_page(page); 628 flush_dcache_page(page);
626 kunmap_atomic(kaddr, KM_USER0); 629 kunmap_atomic(kaddr, KM_USER0);
627 err = 0; 630 err = 0;
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index 9ecf92941b23..01cc35946a9d 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -519,6 +519,7 @@ extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf);
519extern void gfs2_rgrp_in(struct gfs2_rgrp_host *rg, const void *buf); 519extern void gfs2_rgrp_in(struct gfs2_rgrp_host *rg, const void *buf);
520extern void gfs2_rgrp_out(const struct gfs2_rgrp_host *rg, void *buf); 520extern void gfs2_rgrp_out(const struct gfs2_rgrp_host *rg, void *buf);
521extern void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf); 521extern void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf);
522extern void gfs2_quota_out(const struct gfs2_quota_host *qu, void *buf);
522struct gfs2_inode; 523struct gfs2_inode;
523extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf); 524extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
524extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf); 525extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf);