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
Kirill Smelkov
linux
Commits
f5404e21
Commit
f5404e21
authored
Jul 28, 2003
by
Stephen Lord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use i_size_read and i_size_write instead of direct access to the i_size
field.
parent
9d76c64d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
27 deletions
+29
-27
fs/xfs/linux/xfs_aops.c
fs/xfs/linux/xfs_aops.c
+26
-24
fs/xfs/linux/xfs_file.c
fs/xfs/linux/xfs_file.c
+1
-1
fs/xfs/linux/xfs_super.c
fs/xfs/linux/xfs_super.c
+1
-1
fs/xfs/linux/xfs_vnode.c
fs/xfs/linux/xfs_vnode.c
+1
-1
No files found.
fs/xfs/linux/xfs_aops.c
View file @
f5404e21
...
...
@@ -133,7 +133,7 @@ map_blocks(
int
error
,
nmaps
=
1
;
if
(((
flags
&
(
BMAP_DIRECT
|
BMAP_SYNC
))
==
BMAP_DIRECT
)
&&
(
offset
>=
i
node
->
i_size
))
(
offset
>=
i
_size_read
(
inode
)
))
count
=
max_t
(
ssize_t
,
count
,
XFS_WRITE_IO_LOG
);
retry:
VOP_BMAP
(
vp
,
offset
,
count
,
flags
,
pbmapp
,
&
nmaps
,
error
);
...
...
@@ -310,7 +310,7 @@ probe_unmapped_cluster(
struct
buffer_head
*
bh
,
struct
buffer_head
*
head
)
{
unsigned
long
tindex
,
tlast
;
unsigned
long
tindex
,
tlast
,
tloop
;
unsigned
int
len
,
total
=
0
;
struct
address_space
*
mapping
=
inode
->
i_mapping
;
...
...
@@ -325,20 +325,22 @@ probe_unmapped_cluster(
* following pages.
*/
if
(
bh
==
head
)
{
tlast
=
i
node
->
i_size
>>
PAGE_CACHE_SHIFT
;
tlast
=
i
_size_read
(
inode
)
>>
PAGE_CACHE_SHIFT
;
/* Prune this back to avoid pathological behavior */
tl
ast
=
min
(
tlast
,
startpage
->
index
+
64
);
for
(
tindex
=
startpage
->
index
+
1
;
tindex
<
tl
ast
;
tindex
++
)
{
tl
oop
=
min
(
tlast
,
startpage
->
index
+
64
);
for
(
tindex
=
startpage
->
index
+
1
;
tindex
<
tl
oop
;
tindex
++
)
{
len
=
probe_unmapped_page
(
mapping
,
tindex
,
PAGE_CACHE_SIZE
);
if
(
!
len
)
break
;
return
total
;
total
+=
len
;
}
if
((
tindex
==
tlast
)
&&
(
inode
->
i_size
&
~
PAGE_CACHE_MASK
))
{
len
=
probe_unmapped_page
(
mapping
,
tindex
,
inode
->
i_size
&
~
PAGE_CACHE_MASK
);
total
+=
len
;
if
(
tindex
==
tlast
)
{
unsigned
offset
=
i_size_read
(
inode
)
&
(
PAGE_CACHE_SIZE
-
1
);
if
(
offset
)
{
total
+=
probe_unmapped_page
(
mapping
,
tindex
,
offset
);
}
}
}
return
total
;
...
...
@@ -455,12 +457,12 @@ map_unwritten(
*/
if
(
bh
==
head
)
{
struct
address_space
*
mapping
=
inode
->
i_mapping
;
unsigned
long
tindex
,
tlast
,
bs
;
unsigned
long
tindex
,
tl
oop
,
tl
ast
,
bs
;
struct
page
*
page
;
tlast
=
i
node
->
i_size
>>
PAGE_CACHE_SHIFT
;
tl
ast
=
min
(
tlast
,
start_page
->
index
+
pb
->
pb_page_count
-
1
);
for
(
tindex
=
start_page
->
index
+
1
;
tindex
<
tl
ast
;
tindex
++
)
{
tlast
=
i
_size_read
(
inode
)
>>
PAGE_CACHE_SHIFT
;
tl
oop
=
min
(
tlast
,
start_page
->
index
+
pb
->
pb_page_count
-
1
);
for
(
tindex
=
start_page
->
index
+
1
;
tindex
<
tl
oop
;
tindex
++
)
{
page
=
probe_unwritten_page
(
mapping
,
tindex
,
mp
,
pb
,
PAGE_CACHE_SIZE
,
&
bs
);
if
(
!
page
)
...
...
@@ -470,9 +472,9 @@ map_unwritten(
convert_page
(
inode
,
page
,
mp
,
pb
,
1
,
all_bh
);
}
if
((
tindex
==
tlast
)
&&
(
i
node
->
i_size
&
~
PAGE_CACHE_MASK
))
{
if
((
tindex
==
tlast
)
&&
(
i
_size_read
(
inode
)
&
~
PAGE_CACHE_MASK
))
{
page
=
probe_unwritten_page
(
mapping
,
tindex
,
mp
,
pb
,
i
node
->
i_size
&
~
PAGE_CACHE_MASK
,
&
bs
);
i
_size_read
(
inode
)
&
~
PAGE_CACHE_MASK
,
&
bs
);
if
(
page
)
{
nblocks
+=
bs
;
atomic_add
(
bs
,
&
pb
->
pb_io_remaining
);
...
...
@@ -549,11 +551,11 @@ convert_page(
int
i
=
0
,
index
=
0
;
int
bbits
=
inode
->
i_blkbits
;
end_index
=
i
node
->
i_size
>>
PAGE_CACHE_SHIFT
;
end_index
=
i
_size_read
(
inode
)
>>
PAGE_CACHE_SHIFT
;
if
(
page
->
index
<
end_index
)
{
end
=
PAGE_CACHE_SIZE
;
}
else
{
end
=
i
node
->
i_size
&
(
PAGE_CACHE_SIZE
-
1
);
end
=
i
_size_read
(
inode
)
&
(
PAGE_CACHE_SIZE
-
1
);
}
bh
=
head
=
page_buffers
(
page
);
do
{
...
...
@@ -665,9 +667,9 @@ page_state_convert(
/* Are we off the end of the file ? */
end_index
=
i
node
->
i_size
>>
PAGE_CACHE_SHIFT
;
end_index
=
i
_size_read
(
inode
)
>>
PAGE_CACHE_SHIFT
;
if
(
page
->
index
>=
end_index
)
{
unsigned
remaining
=
i
node
->
i_size
&
(
PAGE_CACHE_SIZE
-
1
);
unsigned
remaining
=
i
_size_read
(
inode
)
&
(
PAGE_CACHE_SIZE
-
1
);
if
((
page
->
index
>=
end_index
+
1
)
||
!
remaining
)
{
return
-
EIO
;
}
...
...
@@ -675,8 +677,8 @@ page_state_convert(
offset
=
(
loff_t
)
page
->
index
<<
PAGE_CACHE_SHIFT
;
end_offset
=
offset
+
PAGE_CACHE_SIZE
;
if
(
end_offset
>
i
node
->
i_size
)
end_offset
=
i
node
->
i_size
;
if
(
end_offset
>
i
_size_read
(
inode
)
)
end_offset
=
i
_size_read
(
inode
)
;
bh
=
head
=
page_buffers
(
page
);
mp
=
NULL
;
...
...
@@ -855,7 +857,7 @@ linvfs_get_block_core(
*/
if
(
blocks
)
size
=
blocks
<<
inode
->
i_blkbits
;
else
if
(
create
&&
(
offset
>=
i
node
->
i_size
))
else
if
(
create
&&
(
offset
>=
i
_size_read
(
inode
)
))
size
=
1
<<
XFS_WRITE_IO_LOG
;
else
size
=
1
<<
inode
->
i_blkbits
;
...
...
@@ -903,7 +905,7 @@ linvfs_get_block_core(
*/
if
(
create
&&
((
!
buffer_mapped
(
bh_result
)
&&
!
buffer_uptodate
(
bh_result
))
||
(
offset
>=
i
node
->
i_size
)
||
(
pbmap
.
pbm_flags
&
PBMF_NEW
)))
{
(
offset
>=
i
_size_read
(
inode
)
)
||
(
pbmap
.
pbm_flags
&
PBMF_NEW
)))
{
set_buffer_new
(
bh_result
);
}
...
...
fs/xfs/linux/xfs_file.c
View file @
f5404e21
...
...
@@ -180,7 +180,7 @@ linvfs_open(
vnode_t
*
vp
=
LINVFS_GET_VP
(
inode
);
int
error
;
if
(
!
(
filp
->
f_flags
&
O_LARGEFILE
)
&&
i
node
->
i_size
>
MAX_NON_LFS
)
if
(
!
(
filp
->
f_flags
&
O_LARGEFILE
)
&&
i
_size_read
(
inode
)
>
MAX_NON_LFS
)
return
-
EFBIG
;
ASSERT
(
vp
);
...
...
fs/xfs/linux/xfs_super.c
View file @
f5404e21
...
...
@@ -178,7 +178,7 @@ xfs_revalidate_inode(
}
inode
->
i_blksize
=
PAGE_CACHE_SIZE
;
inode
->
i_generation
=
ip
->
i_d
.
di_gen
;
i
node
->
i_size
=
ip
->
i_d
.
di_size
;
i
_size_write
(
inode
,
ip
->
i_d
.
di_size
)
;
inode
->
i_blocks
=
XFS_FSB_TO_BB
(
mp
,
ip
->
i_d
.
di_nblocks
+
ip
->
i_delayed_blks
);
inode
->
i_atime
.
tv_sec
=
ip
->
i_d
.
di_atime
.
t_sec
;
...
...
fs/xfs/linux/xfs_vnode.c
View file @
f5404e21
...
...
@@ -208,11 +208,11 @@ vn_revalidate(
inode
->
i_nlink
=
va
.
va_nlink
;
inode
->
i_uid
=
va
.
va_uid
;
inode
->
i_gid
=
va
.
va_gid
;
inode
->
i_size
=
va
.
va_size
;
inode
->
i_blocks
=
va
.
va_nblocks
;
inode
->
i_mtime
=
va
.
va_mtime
;
inode
->
i_ctime
=
va
.
va_ctime
;
inode
->
i_atime
=
va
.
va_atime
;
i_size_write
(
inode
,
va
.
va_size
);
VUNMODIFY
(
vp
);
}
return
-
error
;
...
...
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