linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Andrew Morton <akpm@osdl.org>, linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/5] hfs: don't dirty unchanged inode
Date: Mon, 1 Aug 2005 11:42:00 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0508011140440.8772@scrub.home> (raw)

Hi,

If inode size hasn't changed, don't do anything further in truncate, which 
also prevents a dirty inode, what might upset some readonly devices quite 
badly.

---

 fs/hfs/extent.c      |    3 ++-
 fs/hfsplus/extents.c |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6/fs/hfsplus/extents.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/extents.c	2005-07-31 19:22:29.000000000 +0200
+++ linux-2.6/fs/hfsplus/extents.c	2005-07-31 19:25:09.000000000 +0200
@@ -461,7 +461,9 @@ void hfsplus_file_truncate(struct inode 
 		page_cache_release(page);
 		mark_inode_dirty(inode);
 		return;
-	}
+	} else if (inode->i_size == HFSPLUS_I(inode).phys_size)
+		return;
+
 	blk_cnt = (inode->i_size + HFSPLUS_SB(sb).alloc_blksz - 1) >> HFSPLUS_SB(sb).alloc_blksz_shift;
 	alloc_cnt = HFSPLUS_I(inode).alloc_blocks;
 	if (blk_cnt == alloc_cnt)
Index: linux-2.6/fs/hfs/extent.c
===================================================================
--- linux-2.6.orig/fs/hfs/extent.c	2005-07-31 19:22:27.000000000 +0200
+++ linux-2.6/fs/hfs/extent.c	2005-07-31 19:25:09.000000000 +0200
@@ -482,7 +482,8 @@ void hfs_file_truncate(struct inode *ino
 		page_cache_release(page);
 		mark_inode_dirty(inode);
 		return;
-	}
+	} else if (inode->i_size == HFS_I(inode)->phys_size)
+		return;
 	size = inode->i_size + HFS_SB(sb)->alloc_blksz - 1;
 	blk_cnt = size / HFS_SB(sb)->alloc_blksz;
 	alloc_cnt = HFS_I(inode)->alloc_blocks;

             reply	other threads:[~2005-08-01  9:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-01  9:42 Roman Zippel [this message]
2005-08-01  9:49 ` [PATCH 1/5] hfs: don't dirty unchanged inode Roman Zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0508011140440.8772@scrub.home \
    --to=zippel@linux-m68k.org \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).