aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorAndi Kleen <ak@muc.de>2002-11-17 01:10:25 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-11-17 01:10:25 -0800
commit5d62665d6793db5c2a497e21c4171f6a34be3b1a (patch)
treea09e94971522c8c70cd6f1178dfe1cf34f7abdeb /ipc
parent5be2bc3c89f6813ab0ab21cdd27d6d0f2ee94d91 (diff)
downloadhistory-5d62665d6793db5c2a497e21c4171f6a34be3b1a.tar.gz
[PATCH] nanosecond stat timefields
stat64 has been changed to return jiffies granuality as nsec in previously unused fields. This allows make to make better decisions on when to recompile a file. Follows losely the Solaris API. CURRENT_TIME has been redefined to return struct timespec. The users who don't use it in a inode/attr context have been changed to use a new get_seconds() function. CURRENT_TIME is implemented by an out-of-line function. There is a small performance penalty in this patch. The previous filemap code had an optimization to flush atime only once a second. This is currently gone, which will increase flushes a bit. I believe the correct solution if it should be a problem is to have per super block fields that give an arbitary atime flush granuality - so that you can set it to be only flushed once a hour if you prefer that. I will work on that later in separate patches if the need should arise. struct inode and the attr struct has been changed to store struct timespec instead of time_t for [cma]time. Not all file systems support this granuality, but some like XFS,NFSv3,CIFS,JFS do. The others will currently truncate the nsec part on flushing to disk. There was some discussion on this rounding on l-k previously. I went for simple truncation because there is not much evidence IMHO that the more complicated roundings have any advantages. In practice application will be rather unlikely to notice the rounding anyways - they can only see a difference when an inode is flush from memory and reloaded in less than a second, which is rather unlikely.
Diffstat (limited to 'ipc')
-rw-r--r--ipc/msg.c10
-rw-r--r--ipc/sem.c12
-rw-r--r--ipc/shm.c8
3 files changed, 15 insertions, 15 deletions
diff --git a/ipc/msg.c b/ipc/msg.c
index 9129fe9d6c5fbe..b7d556f32552e5 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -115,7 +115,7 @@ static int newque (key_t key, int msgflg)
}
msq->q_stime = msq->q_rtime = 0;
- msq->q_ctime = CURRENT_TIME;
+ msq->q_ctime = get_seconds();
msq->q_cbytes = msq->q_qnum = 0;
msq->q_qbytes = msg_ctlmnb;
msq->q_lspid = msq->q_lrpid = 0;
@@ -532,7 +532,7 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds *buf)
ipcp->gid = setbuf.gid;
ipcp->mode = (ipcp->mode & ~S_IRWXUGO) |
(S_IRWXUGO & setbuf.mode);
- msq->q_ctime = CURRENT_TIME;
+ msq->q_ctime = get_seconds();
/* sleeping receivers might be excluded by
* stricter permissions.
*/
@@ -599,7 +599,7 @@ static int inline pipelined_send(struct msg_queue* msq, struct msg_msg* msg)
} else {
msr->r_msg = msg;
msq->q_lrpid = msr->r_tsk->pid;
- msq->q_rtime = CURRENT_TIME;
+ msq->q_rtime = get_seconds();
wake_up_process(msr->r_tsk);
return 1;
}
@@ -669,7 +669,7 @@ retry:
}
msq->q_lspid = current->pid;
- msq->q_stime = CURRENT_TIME;
+ msq->q_stime = get_seconds();
if(!pipelined_send(msq,msg)) {
/* noone is waiting for this message, enqueue it */
@@ -760,7 +760,7 @@ retry:
}
list_del(&msg->m_list);
msq->q_qnum--;
- msq->q_rtime = CURRENT_TIME;
+ msq->q_rtime = get_seconds();
msq->q_lrpid = current->pid;
msq->q_cbytes -= msg->m_ts;
atomic_sub(msg->m_ts,&msg_bytes);
diff --git a/ipc/sem.c b/ipc/sem.c
index 802394b4020257..a798decd5daedf 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -155,7 +155,7 @@ static int newary (key_t key, int nsems, int semflg)
sma->sem_pending_last = &sma->sem_pending;
/* sma->undo = NULL; */
sma->sem_nsems = nsems;
- sma->sem_ctime = CURRENT_TIME;
+ sma->sem_ctime = get_seconds();
sem_unlock(sma);
return sem_buildid(id, sma->sem_perm.seq);
@@ -296,7 +296,7 @@ static int try_atomic_semop (struct sem_array * sma, struct sembuf * sops,
goto undo;
}
- sma->sem_otime = CURRENT_TIME;
+ sma->sem_otime = get_seconds();
return 0;
out_of_range:
@@ -605,7 +605,7 @@ static int semctl_main(int semid, int semnum, int cmd, int version, union semun
for (un = sma->undo; un; un = un->id_next)
for (i = 0; i < nsems; i++)
un->semadj[i] = 0;
- sma->sem_ctime = CURRENT_TIME;
+ sma->sem_ctime = get_seconds();
/* maybe some queued-up processes were waiting for this */
update_queue(sma);
err = 0;
@@ -657,7 +657,7 @@ static int semctl_main(int semid, int semnum, int cmd, int version, union semun
un->semadj[semnum] = 0;
curr->semval = val;
curr->sempid = current->pid;
- sma->sem_ctime = CURRENT_TIME;
+ sma->sem_ctime = get_seconds();
/* maybe some queued-up processes were waiting for this */
update_queue(sma);
err = 0;
@@ -749,7 +749,7 @@ static int semctl_down(int semid, int semnum, int cmd, int version, union semun
ipcp->gid = setbuf.gid;
ipcp->mode = (ipcp->mode & ~S_IRWXUGO)
| (setbuf.mode & S_IRWXUGO);
- sma->sem_ctime = CURRENT_TIME;
+ sma->sem_ctime = get_seconds();
sem_unlock(sma);
err = 0;
break;
@@ -1228,7 +1228,7 @@ found:
sem->semval = 0; /* shouldn't happen */
sem->sempid = current->pid;
}
- sma->sem_otime = CURRENT_TIME;
+ sma->sem_otime = get_seconds();
/* maybe some queued-up processes were waiting for this */
update_queue(sma);
next_entry:
diff --git a/ipc/shm.c b/ipc/shm.c
index ccd3947cb543a8..1b868efbf85848 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -88,7 +88,7 @@ static inline void shm_inc (int id) {
if(!(shp = shm_lock(id)))
BUG();
- shp->shm_atim = CURRENT_TIME;
+ shp->shm_atim = get_seconds();
shp->shm_lprid = current->pid;
shp->shm_nattch++;
shm_unlock(shp);
@@ -137,7 +137,7 @@ static void shm_close (struct vm_area_struct *shmd)
if(!(shp = shm_lock(id)))
BUG();
shp->shm_lprid = current->pid;
- shp->shm_dtim = CURRENT_TIME;
+ shp->shm_dtim = get_seconds();
shp->shm_nattch--;
if(shp->shm_nattch == 0 &&
shp->shm_flags & SHM_DEST)
@@ -212,7 +212,7 @@ static int newseg (key_t key, int shmflg, size_t size)
shp->shm_cprid = current->pid;
shp->shm_lprid = 0;
shp->shm_atim = shp->shm_dtim = 0;
- shp->shm_ctim = CURRENT_TIME;
+ shp->shm_ctim = get_seconds();
shp->shm_segsz = size;
shp->shm_nattch = 0;
shp->id = shm_buildid(id,shp->shm_perm.seq);
@@ -566,7 +566,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)
shp->shm_perm.gid = setbuf.gid;
shp->shm_flags = (shp->shm_flags & ~S_IRWXUGO)
| (setbuf.mode & S_IRWXUGO);
- shp->shm_ctim = CURRENT_TIME;
+ shp->shm_ctim = get_seconds();
break;
}