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
3d3dfabe
Commit
3d3dfabe
authored
Dec 03, 2002
by
Dave Kleikamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge shaggy.austin.ibm.com:/shaggy/bk/jfs-2.5
into shaggy.austin.ibm.com:/shaggy/bk/perf-2.5
parents
c8495d3e
3332269d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
53 deletions
+56
-53
fs/jfs/file.c
fs/jfs/file.c
+1
-53
fs/jfs/inode.c
fs/jfs/inode.c
+55
-0
No files found.
fs/jfs/file.c
View file @
3d3dfabe
...
...
@@ -27,6 +27,7 @@
extern
int
jfs_commit_inode
(
struct
inode
*
,
int
);
extern
void
jfs_truncate
(
struct
inode
*
);
int
jfs_fsync
(
struct
file
*
file
,
struct
dentry
*
dentry
,
int
datasync
)
{
...
...
@@ -43,59 +44,6 @@ int jfs_fsync(struct file *file, struct dentry *dentry, int datasync)
return
rc
?
-
EIO
:
0
;
}
/*
* Guts of jfs_truncate. Called with locks already held. Can be called
* with directory for truncating directory index table.
*/
void
jfs_truncate_nolock
(
struct
inode
*
ip
,
loff_t
length
)
{
loff_t
newsize
;
tid_t
tid
;
ASSERT
(
length
>=
0
);
if
(
test_cflag
(
COMMIT_Nolink
,
ip
))
{
xtTruncate
(
0
,
ip
,
length
,
COMMIT_WMAP
);
return
;
}
do
{
tid
=
txBegin
(
ip
->
i_sb
,
0
);
/*
* The commit_sem cannot be taken before txBegin.
* txBegin may block and there is a chance the inode
* could be marked dirty and need to be committed
* before txBegin unblocks
*/
down
(
&
JFS_IP
(
ip
)
->
commit_sem
);
newsize
=
xtTruncate
(
tid
,
ip
,
length
,
COMMIT_TRUNCATE
|
COMMIT_PWMAP
);
if
(
newsize
<
0
)
{
txEnd
(
tid
);
up
(
&
JFS_IP
(
ip
)
->
commit_sem
);
break
;
}
ip
->
i_mtime
=
ip
->
i_ctime
=
CURRENT_TIME
;
mark_inode_dirty
(
ip
);
txCommit
(
tid
,
1
,
&
ip
,
0
);
txEnd
(
tid
);
up
(
&
JFS_IP
(
ip
)
->
commit_sem
);
}
while
(
newsize
>
length
);
/* Truncate isn't always atomic */
}
static
void
jfs_truncate
(
struct
inode
*
ip
)
{
jFYI
(
1
,
(
"jfs_truncate: size = 0x%lx
\n
"
,
(
ulong
)
ip
->
i_size
));
IWRITE_LOCK
(
ip
);
jfs_truncate_nolock
(
ip
,
ip
->
i_size
);
IWRITE_UNLOCK
(
ip
);
}
static
int
jfs_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
int
rc
;
...
...
fs/jfs/inode.c
View file @
3d3dfabe
...
...
@@ -330,3 +330,58 @@ struct address_space_operations jfs_aops = {
.
bmap
=
jfs_bmap
,
.
direct_IO
=
jfs_direct_IO
,
};
/*
* Guts of jfs_truncate. Called with locks already held. Can be called
* with directory for truncating directory index table.
*/
void
jfs_truncate_nolock
(
struct
inode
*
ip
,
loff_t
length
)
{
loff_t
newsize
;
tid_t
tid
;
ASSERT
(
length
>=
0
);
if
(
test_cflag
(
COMMIT_Nolink
,
ip
))
{
xtTruncate
(
0
,
ip
,
length
,
COMMIT_WMAP
);
return
;
}
do
{
tid
=
txBegin
(
ip
->
i_sb
,
0
);
/*
* The commit_sem cannot be taken before txBegin.
* txBegin may block and there is a chance the inode
* could be marked dirty and need to be committed
* before txBegin unblocks
*/
down
(
&
JFS_IP
(
ip
)
->
commit_sem
);
newsize
=
xtTruncate
(
tid
,
ip
,
length
,
COMMIT_TRUNCATE
|
COMMIT_PWMAP
);
if
(
newsize
<
0
)
{
txEnd
(
tid
);
up
(
&
JFS_IP
(
ip
)
->
commit_sem
);
break
;
}
ip
->
i_mtime
=
ip
->
i_ctime
=
CURRENT_TIME
;
mark_inode_dirty
(
ip
);
txCommit
(
tid
,
1
,
&
ip
,
0
);
txEnd
(
tid
);
up
(
&
JFS_IP
(
ip
)
->
commit_sem
);
}
while
(
newsize
>
length
);
/* Truncate isn't always atomic */
}
void
jfs_truncate
(
struct
inode
*
ip
)
{
jFYI
(
1
,
(
"jfs_truncate: size = 0x%lx
\n
"
,
(
ulong
)
ip
->
i_size
));
block_truncate_page
(
ip
->
i_mapping
,
ip
->
i_size
,
jfs_get_block
);
IWRITE_LOCK
(
ip
);
jfs_truncate_nolock
(
ip
,
ip
->
i_size
);
IWRITE_UNLOCK
(
ip
);
}
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