aboutsummaryrefslogtreecommitdiff
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-13 08:30:33 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-13 08:30:33 -0700
commita5344a9555fffd045218aced89afd6ca0f884e10 (patch)
tree85fcb093a18fe6858dffa66b733a99a30f117926 /fs/gfs2/ops_address.c
parent411fdc1a711665cb4bd13df2a75213153d463375 (diff)
parent370298e2e6f513bc4a9e9445eeed060d8c31f1ca (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes: [GFS2] Update git tree name/location [DLM] fix iovec length in recvmsg [GFS2] Pass the correct value to kunmap_atomic [GFS2] Fix bug where lock not held [DLM] Kconfig: don't show an empty DLM menu [GFS2] Fix uninitialised variable [GFS2] Fix a size calculation error
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 4fb743f4e4a..e0599fed99c 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -162,7 +162,7 @@ static int zero_readpage(struct page *page)
kaddr = kmap_atomic(page, KM_USER0);
memset(kaddr, 0, PAGE_CACHE_SIZE);
- kunmap_atomic(page, KM_USER0);
+ kunmap_atomic(kaddr, KM_USER0);
SetPageUptodate(page);
@@ -195,7 +195,7 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
ip->i_di.di_size);
memset(kaddr + ip->i_di.di_size, 0, PAGE_CACHE_SIZE - ip->i_di.di_size);
- kunmap_atomic(page, KM_USER0);
+ kunmap_atomic(kaddr, KM_USER0);
brelse(dibh);
@@ -370,19 +370,22 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + from;
loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
struct gfs2_alloc *al;
+ unsigned int write_len = to - from;
+
gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|GL_AOP, &ip->i_gh);
error = gfs2_glock_nq_m_atime(1, &ip->i_gh);
if (error)
goto out_uninit;
- gfs2_write_calc_reserv(ip, to - from, &data_blocks, &ind_blocks);
+ gfs2_write_calc_reserv(ip, write_len, &data_blocks, &ind_blocks);
- error = gfs2_write_alloc_required(ip, pos, from - to, &alloc_required);
+ error = gfs2_write_alloc_required(ip, pos, write_len, &alloc_required);
if (error)
goto out_unlock;
+ ip->i_alloc.al_requested = 0;
if (alloc_required) {
al = gfs2_alloc_get(ip);
@@ -482,7 +485,7 @@ static int gfs2_commit_write(struct file *file, struct page *page,
kaddr = kmap_atomic(page, KM_USER0);
memcpy(dibh->b_data + sizeof(struct gfs2_dinode) + from,
kaddr + from, to - from);
- kunmap_atomic(page, KM_USER0);
+ kunmap_atomic(kaddr, KM_USER0);
SetPageUptodate(page);