9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: arisawa <arisawa@ar.aichi-u.ac.jp>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] curious mtime of cwfs
Date: Mon, 25 Feb 2013 16:24:30 +0900	[thread overview]
Message-ID: <06B26204-D2D9-4438-8EB3-603B88F8B03C@ar.aichi-u.ac.jp> (raw)
In-Reply-To: <1a6cb4cfd1c284bb6b0206a0c0e11b0c@rei2.9hal>

Hello sinap,

thank you for your quick fix.
your patches work also for me.

however the problem is not only in dump but (I think) in all directories of cwfs.

#
#	fossil
#
ar% ls -lt
--rw-r--r-- M 546403 arisawa arisawa  1123 Apr  3  2001 a.c
--rwxrwxr-x M 546403 arisawa arisawa 39276 Mar 31  2001 8.out
--rw-rw-r-- M 546403 arisawa arisawa  4559 Mar 31  2001 a.8
--rw-r--r-- M 546403 arisawa arisawa   248 Mar 31  2001 mkfile
ar% ls -ld .
d-rwxrwxrwx M 546403 arisawa arisawa 0 Aug  5  2002 wrk
ar% touch a.c
ar% ls -ld .
d-rwxrwxrwx M 546403 arisawa arisawa 0 Feb 25 16:02 wrk
# this is OK because the directory  is updated
ar% 

#
#	cwfs
#
maia# ls -lt
--rw-rw-r-- M 20 arisawa arisawa 43320 Feb 25 15:50 cw.c
d-rwxrwxr-x M 20 arisawa arisawa     0 Feb 17 17:43 cwfs64x
...
maia# ls -ld .
d-rwxrwxr-x M 20 arisawa arisawa 0 Sep 11 14:17 cwfs
# NG because cw.c updated this time.
maia#

Kenji Arisawa

On 2013/02/25, at 14:55, cinap_lenrek@gmx.de wrote:

> yes. very good observation. the following change fixes it for me (with added comments)
> 
> term% hg diff -r 1763 cw.c
> diff -r 5229de0742e8 sys/src/cmd/cwfs/cw.c
> --- a/sys/src/cmd/cwfs/cw.c	Tue Jul 24 19:42:18 2012 +0200
> +++ b/sys/src/cmd/cwfs/cw.c	Mon Feb 25 06:30:55 2013 +0100
> @@ -1557,14 +1557,13 @@
> 	d1->uid = d->uid;
> 	d1->gid = d->gid;
> 	putbuf(p);
> -	accessdir(p1, d1, FWRITE, 0);	<- was modifying yyyy direcoty in case when added, will do below instead
> +	accessdir(pr, dr, FWRITE, 0);	<- update mtime of dumproot as we added yyyy directory
> 
> 	/*
> 	 * put mmdd[count] in year directory
> 	 */
> found2:
> -	accessdir(p1, d1, FREAD, 0);	<- was updating atime of yyyy direcotory in case when it was already present. this is not needed as we'r going to always update both atime and mtime below
> -	p1->flags |= Bmod;	/* noatime */
> +	accessdir(pr, dr, FREAD, 0);	<- update atime of dumproot only as we didnt add a new yyyy direcotory
> 	putbuf(pr);
> 	pr = p1;						<- yyyy directory become pr/dr
> 	dr = d1;
> @@ -1603,6 +1602,7 @@
> 	d1->qid.version += n;
> 	accessdir(p1, d1, FWRITE, 0);	<- update dump sub directory times
> 	putbuf(p1);
> +	accessdir(pr, dr, FWRITE, 0);	<- now update atime and mtime of yyyy directory after creating dump sub directory in it
> 	putbuf(pr);
> 
> 	cw->fsize = cwsize(cw->dev);
> 
> the problem was that we only updated mtime of the yyyy directory when
> we newly created it, otherwise only access time was updated. but we
> *always* have to update mtime of the yyyy directory because we are
> modifying it by creating the dump sub directory in it.
> 
> --
> cinap
> 




  reply	other threads:[~2013-02-25  7:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25  1:04 arisawa
2013-02-25  1:17 ` arisawa
2013-02-25  5:55   ` cinap_lenrek
2013-02-25  7:24     ` arisawa [this message]
2013-02-25  8:23       ` cinap_lenrek
2013-02-25 10:17         ` arisawa
2013-02-25 10:34         ` Anthony Martin
2013-02-25 11:27           ` cinap_lenrek
2013-02-25 11:39           ` arisawa
2013-03-02 21:08           ` erik quanstrom
2013-03-03  3:30             ` arisawa

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=06B26204-D2D9-4438-8EB3-603B88F8B03C@ar.aichi-u.ac.jp \
    --to=arisawa@ar.aichi-u.ac.jp \
    --cc=9fans@9fans.net \
    /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).