Commit 1990e917 authored by Abhijith Das's avatar Abhijith Das Committed by Steven Whitehouse

[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: default avatarAbhijith Das <adas@redhat.com>
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 0b7cac0f
...@@ -121,6 +121,16 @@ void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf) ...@@ -121,6 +121,16 @@ void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf)
qu->qu_value = be64_to_cpu(str->qu_value); qu->qu_value = be64_to_cpu(str->qu_value);
} }
void gfs2_quota_out(const struct gfs2_quota_host *qu, void *buf)
{
struct gfs2_quota *str = buf;
str->qu_limit = cpu_to_be64(qu->qu_limit);
str->qu_warn = cpu_to_be64(qu->qu_warn);
str->qu_value = cpu_to_be64(qu->qu_value);
memset(&str->qu_reserved, 0, sizeof(str->qu_reserved));
}
void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
{ {
const struct gfs2_dinode_host *di = &ip->i_di; const struct gfs2_dinode_host *di = &ip->i_di;
......
...@@ -573,12 +573,13 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, ...@@ -573,12 +573,13 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
struct inode *inode = &ip->i_inode; struct inode *inode = &ip->i_inode;
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
unsigned long index = loc >> PAGE_CACHE_SHIFT; unsigned long index = loc >> PAGE_CACHE_SHIFT;
unsigned offset = loc & (PAGE_CACHE_SHIFT - 1); unsigned offset = loc & (PAGE_CACHE_SIZE - 1);
unsigned blocksize, iblock, pos; unsigned blocksize, iblock, pos;
struct buffer_head *bh; struct buffer_head *bh;
struct page *page; struct page *page;
void *kaddr; void *kaddr;
__be64 *ptr; char *ptr;
struct gfs2_quota_host qp;
s64 value; s64 value;
int err = -EIO; int err = -EIO;
...@@ -620,8 +621,10 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, ...@@ -620,8 +621,10 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
kaddr = kmap_atomic(page, KM_USER0); kaddr = kmap_atomic(page, KM_USER0);
ptr = kaddr + offset; ptr = kaddr + offset;
value = (s64)be64_to_cpu(*ptr) + change; gfs2_quota_in(&qp, ptr);
*ptr = cpu_to_be64(value); qp.qu_value += change;
value = qp.qu_value;
gfs2_quota_out(&qp, ptr);
flush_dcache_page(page); flush_dcache_page(page);
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
err = 0; err = 0;
......
...@@ -519,6 +519,7 @@ extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf); ...@@ -519,6 +519,7 @@ extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf);
extern void gfs2_rgrp_in(struct gfs2_rgrp_host *rg, const void *buf); extern void gfs2_rgrp_in(struct gfs2_rgrp_host *rg, const void *buf);
extern void gfs2_rgrp_out(const struct gfs2_rgrp_host *rg, void *buf); extern void gfs2_rgrp_out(const struct gfs2_rgrp_host *rg, void *buf);
extern void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf); extern void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf);
extern void gfs2_quota_out(const struct gfs2_quota_host *qu, void *buf);
struct gfs2_inode; struct gfs2_inode;
extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf); extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf); extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment