FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 12-12-2007, 12:07 AM
Bob Peterson
 
Default Shortcut in gfs2_write_alloc_require

Hi,

The gfs2_prepare_write function goes to a lot of trouble trying
to figure out if a block allocation will be required for the write.
This adds a shortcut: If you're trying to write past end of file,
of course you need a new block. This saves us some time.
This much safer than other alternatives I've put on the table.

Regards,

Bob Peterson
Red Hat GFS

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
--
.../fs/gfs2/bmap.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/gfs2-2.6.git.patch4/fs/gfs2/bmap.c b/gfs2-2.6.git.patch5/fs/gfs2/bmap.c
index 4948602..4cdf4d4 100644
--- a/gfs2-2.6.git.patch4/fs/gfs2/bmap.c
+++ b/gfs2-2.6.git.patch5/fs/gfs2/bmap.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
- * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
@@ -1204,6 +1204,11 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,

*alloc_required = 0;

+ if (offset + len > ip->i_di.di_size) { /* writing past end of file */
+ *alloc_required = 1;
+ return 0;
+ }
+
if (!len)
return 0;
 

Thread Tools




All times are GMT. The time now is 05:16 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org