Skip to contentSkip to conversation

GFS2: bz 496716 - GFS2 ">>" will not update ctime, mtime after appending to the file

PATCH New Abhijith Das 2 participants 2 messages May 12, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: bz 496716 - GFS2 ">>" will not update ctime, mtime after appending to the file

This patch copies the timestamps from the vfs inode into gfs2 and syncs it to the disk inode during writes.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bz496716-4-git.patch
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20090512/7fe37e47/attachment.ksh>

#1 lore raw

PATCH 1/1 GFS2: bz 496716 - GFS2 ">>" will not update ctime, mtime after appending to the file

Hi,

Now in the -nmw git tree. Thanks,

Steve.

Quoted 50 lines · Abhijith Das

This patch copies the timestamps from the vfs inode into gfs2 and syncs it to the disk inode during writes.

plain text document attachment (bz496716-4-git.patch)

fs/gfs2/ops_address.c +10 -10
index a6dde17..e566421 100644
@@ -781,10 +781,12 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
 	unlock_page(page);
 	page_cache_release(page);
 
-	if (inode->i_size < to) {
-		i_size_write(inode, to);
-		ip->i_disksize = inode->i_size;
-		di->di_size = cpu_to_be64(inode->i_size);
+	if (copied) {
+		if (inode->i_size < to) {
+			i_size_write(inode, to);
+			ip->i_disksize = inode->i_size;
+		}
+		gfs2_dinode_out(ip, di);
 		mark_inode_dirty(inode);
 	}
 
@@ -824,7 +826,6 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
 	struct gfs2_sbd *sdp = GFS2_SB(inode);
 	struct buffer_head *dibh;
 	struct gfs2_alloc *al = ip->i_alloc;
-	struct gfs2_dinode *di;
 	unsigned int from = pos & (PAGE_CACHE_SIZE - 1);
 	unsigned int to = from + len;
 	int ret;
@@ -847,11 +848,10 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
 		gfs2_page_add_databufs(ip, page, from, to);
 
 	ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
-
-	if (likely(ret >= 0) && (inode->i_size > ip->i_disksize)) {
-		di = (struct gfs2_dinode *)dibh->b_data;
-		ip->i_disksize = inode->i_size;
-		di->di_size = cpu_to_be64(inode->i_size);
+	if (ret > 0) {
+		if (inode->i_size > ip->i_disksize)
+			ip->i_disksize = inode->i_size;
+		gfs2_dinode_out(ip, dibh->b_data);
 		mark_inode_dirty(inode);
 	}