Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
5f9861a6
Commit
5f9861a6
authored
Mar 18, 2004
by
Alexander Viro
Committed by
David S. Miller
Mar 18, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] add file_accessed() helper
New inlined helper - file_accessed(file) (wrapper for update_atime())
parent
d2a4a177
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
22 deletions
+20
-22
drivers/char/random.c
drivers/char/random.c
+2
-3
fs/coda/dir.c
fs/coda/dir.c
+1
-1
fs/hugetlbfs/inode.c
fs/hugetlbfs/inode.c
+1
-1
fs/pipe.c
fs/pipe.c
+1
-1
fs/readdir.c
fs/readdir.c
+1
-1
include/linux/fs.h
include/linux/fs.h
+7
-1
ipc/shm.c
ipc/shm.c
+1
-1
mm/filemap.c
mm/filemap.c
+3
-4
mm/shmem.c
mm/shmem.c
+3
-9
No files found.
drivers/char/random.c
View file @
5f9861a6
...
...
@@ -1640,9 +1640,8 @@ random_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
/*
* If we gave the user some bytes, update the access time.
*/
if
(
count
!=
0
)
{
update_atime
(
file
->
f_dentry
->
d_inode
);
}
if
(
count
)
file_accessed
(
file
);
return
(
count
?
count
:
retval
);
}
...
...
fs/coda/dir.c
View file @
5f9861a6
...
...
@@ -512,7 +512,7 @@ int coda_readdir(struct file *coda_file, void *dirent, filldir_t filldir)
ret
=
-
ENOENT
;
if
(
!
IS_DEADDIR
(
host_inode
))
{
ret
=
host_file
->
f_op
->
readdir
(
host_file
,
filldir
,
dirent
);
update_atime
(
host_inod
e
);
file_accessed
(
host_fil
e
);
}
}
out:
...
...
fs/hugetlbfs/inode.c
View file @
5f9861a6
...
...
@@ -62,7 +62,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
vma_len
=
(
loff_t
)(
vma
->
vm_end
-
vma
->
vm_start
);
down
(
&
inode
->
i_sem
);
update_atime
(
inod
e
);
file_accessed
(
fil
e
);
vma
->
vm_flags
|=
VM_HUGETLB
|
VM_RESERVED
;
vma
->
vm_ops
=
&
hugetlb_vm_ops
;
ret
=
hugetlb_prefault
(
mapping
,
vma
);
...
...
fs/pipe.c
View file @
5f9861a6
...
...
@@ -165,7 +165,7 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
kill_fasync
(
PIPE_FASYNC_WRITERS
(
*
inode
),
SIGIO
,
POLL_OUT
);
}
if
(
ret
>
0
)
update_atime
(
inode
);
file_accessed
(
filp
);
return
ret
;
}
...
...
fs/readdir.c
View file @
5f9861a6
...
...
@@ -32,7 +32,7 @@ int vfs_readdir(struct file *file, filldir_t filler, void *buf)
res
=
-
ENOENT
;
if
(
!
IS_DEADDIR
(
inode
))
{
res
=
file
->
f_op
->
readdir
(
file
,
buf
,
filler
);
update_atime
(
inod
e
);
file_accessed
(
fil
e
);
}
up
(
&
inode
->
i_sem
);
out:
...
...
include/linux/fs.h
View file @
5f9861a6
...
...
@@ -914,6 +914,11 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
__mark_inode_dirty
(
inode
,
I_DIRTY_SYNC
);
}
static
inline
void
file_accessed
(
struct
file
*
file
)
{
update_atime
(
file
->
f_dentry
->
d_inode
);
}
/**
* &export_operations - for nfsd to communicate with file systems
...
...
@@ -1321,7 +1326,8 @@ extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t l
ssize_t
generic_file_write_nolock
(
struct
file
*
file
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
*
ppos
);
extern
ssize_t
generic_file_sendfile
(
struct
file
*
,
loff_t
*
,
size_t
,
read_actor_t
,
void
__user
*
);
extern
void
do_generic_mapping_read
(
struct
address_space
*
,
struct
file_ra_state
*
,
struct
file
*
,
extern
void
do_generic_mapping_read
(
struct
address_space
*
mapping
,
struct
file_ra_state
*
,
struct
file
*
,
loff_t
*
,
read_descriptor_t
*
,
read_actor_t
);
extern
void
file_ra_state_init
(
struct
file_ra_state
*
ra
,
struct
address_space
*
mapping
);
...
...
ipc/shm.c
View file @
5f9861a6
...
...
@@ -149,7 +149,7 @@ static void shm_close (struct vm_area_struct *shmd)
static
int
shm_mmap
(
struct
file
*
file
,
struct
vm_area_struct
*
vma
)
{
update_atime
(
file
->
f_dentry
->
d_inod
e
);
file_accessed
(
fil
e
);
vma
->
vm_ops
=
&
shm_vm_ops
;
shm_inc
(
file
->
f_dentry
->
d_inode
->
i_ino
);
return
0
;
...
...
mm/filemap.c
View file @
5f9861a6
...
...
@@ -725,7 +725,7 @@ void do_generic_mapping_read(struct address_space *mapping,
*
ppos
=
((
loff_t
)
index
<<
PAGE_CACHE_SHIFT
)
+
offset
;
if
(
cached_page
)
page_cache_release
(
cached_page
);
update_atime
(
inode
);
file_accessed
(
filp
);
}
EXPORT_SYMBOL
(
do_generic_mapping_read
);
...
...
@@ -820,7 +820,7 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
if
(
retval
>
0
)
*
ppos
=
pos
+
retval
;
}
update_atime
(
filp
->
f_dentry
->
d_inode
);
file_accessed
(
filp
);
goto
out
;
}
...
...
@@ -1353,11 +1353,10 @@ static struct vm_operations_struct generic_file_vm_ops = {
int
generic_file_mmap
(
struct
file
*
file
,
struct
vm_area_struct
*
vma
)
{
struct
address_space
*
mapping
=
file
->
f_mapping
;
struct
inode
*
inode
=
mapping
->
host
;
if
(
!
mapping
->
a_ops
->
readpage
)
return
-
ENOEXEC
;
update_atime
(
inod
e
);
file_accessed
(
fil
e
);
vma
->
vm_ops
=
&
generic_file_vm_ops
;
return
0
;
}
...
...
mm/shmem.c
View file @
5f9861a6
...
...
@@ -1061,14 +1061,8 @@ void shmem_lock(struct file *file, int lock)
static
int
shmem_mmap
(
struct
file
*
file
,
struct
vm_area_struct
*
vma
)
{
struct
vm_operations_struct
*
ops
;
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
ops
=
&
shmem_vm_ops
;
if
(
!
S_ISREG
(
inode
->
i_mode
))
return
-
EACCES
;
update_atime
(
inode
);
vma
->
vm_ops
=
ops
;
file_accessed
(
file
);
vma
->
vm_ops
=
&
shmem_vm_ops
;
return
0
;
}
...
...
@@ -1363,7 +1357,7 @@ static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_
}
*
ppos
=
((
loff_t
)
index
<<
PAGE_CACHE_SHIFT
)
+
offset
;
update_atime
(
inode
);
file_accessed
(
filp
);
}
static
ssize_t
shmem_file_read
(
struct
file
*
filp
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment