diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 10:29:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 10:29:15 -0400 |
commit | 677abe49ad017679627af9d3bbd9a7ecb3d94c42 (patch) | |
tree | 7cdb7fbc95b51b288e923a3978e17ed2207a4118 /fs/gfs2/bmap.c | |
parent | e90e4d9234c953b29267cc4fc9ad804128773313 (diff) | |
parent | 6a99be5d7b5973767b1ffa4fa68fed0738589c99 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw:
GFS2: Fix typo
GFS2: stuck in inode wait, no glocks stuck
GFS2: Eliminate useless err variable
GFS2: Fix writing to non-page aligned gfs2_quota structures
GFS2: Add some useful messages
GFS2: fix quota state reporting
GFS2: Various gfs2_logd improvements
GFS2: glock livelock
GFS2: Clean up stuffed file copying
GFS2: docs update
GFS2: Remove space from slab cache name
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r-- | fs/gfs2/bmap.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 5e411d5f4697..4a48c0f4b402 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -71,11 +71,13 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
71 | 71 | ||
72 | if (!PageUptodate(page)) { | 72 | if (!PageUptodate(page)) { |
73 | void *kaddr = kmap(page); | 73 | void *kaddr = kmap(page); |
74 | u64 dsize = i_size_read(inode); | ||
75 | |||
76 | if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode))) | ||
77 | dsize = dibh->b_size - sizeof(struct gfs2_dinode); | ||
74 | 78 | ||
75 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), | 79 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); |
76 | ip->i_disksize); | 80 | memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize); |
77 | memset(kaddr + ip->i_disksize, 0, | ||
78 | PAGE_CACHE_SIZE - ip->i_disksize); | ||
79 | kunmap(page); | 81 | kunmap(page); |
80 | 82 | ||
81 | SetPageUptodate(page); | 83 | SetPageUptodate(page); |
@@ -1038,13 +1040,14 @@ static int trunc_start(struct gfs2_inode *ip, u64 size) | |||
1038 | goto out; | 1040 | goto out; |
1039 | 1041 | ||
1040 | if (gfs2_is_stuffed(ip)) { | 1042 | if (gfs2_is_stuffed(ip)) { |
1041 | ip->i_disksize = size; | 1043 | u64 dsize = size + sizeof(struct gfs2_inode); |
1042 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; | 1044 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; |
1043 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 1045 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
1044 | gfs2_dinode_out(ip, dibh->b_data); | 1046 | gfs2_dinode_out(ip, dibh->b_data); |
1045 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + size); | 1047 | if (dsize > dibh->b_size) |
1048 | dsize = dibh->b_size; | ||
1049 | gfs2_buffer_clear_tail(dibh, dsize); | ||
1046 | error = 1; | 1050 | error = 1; |
1047 | |||
1048 | } else { | 1051 | } else { |
1049 | if (size & (u64)(sdp->sd_sb.sb_bsize - 1)) | 1052 | if (size & (u64)(sdp->sd_sb.sb_bsize - 1)) |
1050 | error = gfs2_block_truncate_page(ip->i_inode.i_mapping); | 1053 | error = gfs2_block_truncate_page(ip->i_inode.i_mapping); |