git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
To: GIT <git@vger.kernel.org>, Linus Torvalds <torvalds@osdl.org>
Subject: Alternate Patch: [PATCH] Don't include device number in cache invalidation when running on NFS
Date: Sun, 22 May 2005 23:41:15 +0200	[thread overview]
Message-ID: <20050522214115.GD23388@cip.informatik.uni-erlangen.de> (raw)
In-Reply-To: <20050522212312.GC23388@cip.informatik.uni-erlangen.de>

Hello,

* Thomas Glanzmann <sithglan@stud.uni-erlangen.de> [050522 23:24]:
> Hello,

> > Sorry, I meant "rename", not "link", and yes, it should be NFS-safe. It's 
> > how all the mailers do things too, afaik.

> okay. I will doublecheck that and come back.

yes, you're right.

While reading liblockfile I saw the following:

/*
 *      See if the directory where is certain file is in
 *      is located on an NFS mounted volume.
 */
static int is_nfs(const char *file)
{
        char dir[1024];
        char *s;
        struct stat st;

        strncpy(dir, file, sizeof(dir));
        if ((s = strrchr(dir, '/')) != NULL)
                *s = 0;
        else
                strcpy(dir, ".");

        if (stat(dir, &st) < 0)
                return 0;

        return ((st.st_dev & 0xFF00) == 0);
}

So here comes an alternate patch if you like to verify the st_dev for non
NFS stuff. Also tested.

[PATCH] Don't include device number in cache invalidation when running on NFS

This patches includes the device number only in the cache invalidation
process when not running on a NFS volume.

Signed-off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>

diff --git a/read-cache.c b/read-cache.c
--- a/read-cache.c
+++ b/read-cache.c
@@ -65,8 +65,11 @@ int ce_match_stat(struct cache_entry *ce
 	if (ce->ce_uid != htonl(st->st_uid) ||
 	    ce->ce_gid != htonl(st->st_gid))
 		changed |= OWNER_CHANGED;
-	if (ce->ce_dev != htonl(st->st_dev) ||
-	    ce->ce_ino != htonl(st->st_ino))
+	/* Only include device number if not running on NFS */
+	if (ce->ce_dev != htonl(st->st_dev) &&
+	    ((st->st_dev & 0xFF00) == 0))
+		changed |= INODE_CHANGED;
+	if (ce->ce_ino != htonl(st->st_ino))
 		changed |= INODE_CHANGED;
 	if (ce->ce_size != htonl(st->st_size))
 		changed |= DATA_CHANGED;

  reply	other threads:[~2005-05-22 21:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-22 12:28 running git-update-cache --refresh on different machines on a NFS share always ends up in a lot of io/cpu/time waste Thomas Glanzmann
2005-05-22 19:09 ` Linus Torvalds
2005-05-22 19:27   ` Thomas Glanzmann
2005-05-22 20:43     ` Linus Torvalds
2005-05-22 21:23       ` [PATCH] Don't include devicenumber into INODE_CHANGED test [WAS: Re: running git-update-cache --refresh on different machines on a NFS share always ends up in a lot of io/cpu/time waste] Thomas Glanzmann
2005-05-22 21:41         ` Thomas Glanzmann [this message]
2005-05-22 21:58           ` Alternate Patch: [PATCH] Don't include device number in cache invalidation when running on NFS Linus Torvalds
2005-05-22 22:07             ` Thomas Glanzmann

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=20050522214115.GD23388@cip.informatik.uni-erlangen.de \
    --to=sithglan@stud.uni-erlangen.de \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.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).