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
f40661be
Commit
f40661be
authored
Jan 13, 2005
by
Anton Altaparmakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NTFS: Optimise/reorganise some error handling code in fs/ntfs/aops.c.
Signed-off-by:
Anton Altaparmakov
<
aia21@cantab.net
>
parent
946929d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
fs/ntfs/aops.c
fs/ntfs/aops.c
+6
-11
No files found.
fs/ntfs/aops.c
View file @
f40661be
...
...
@@ -1392,14 +1392,11 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
attr_len
=
le32_to_cpu
(
ctx
->
attr
->
data
.
resident
.
value_length
);
i_size
=
i_size_read
(
vi
);
kaddr
=
kmap_atomic
(
page
,
KM_USER0
);
if
(
unlikely
(
attr_len
>
i_size
))
{
/* Zero out of bounds area in the mft record. */
memset
((
u8
*
)
ctx
->
attr
+
le16_to_cpu
(
ctx
->
attr
->
data
.
resident
.
value_offset
)
+
i_size
,
0
,
attr_len
-
i_size
);
attr_len
=
i_size
;
ctx
->
attr
->
data
.
resident
.
value_length
=
cpu_to_le32
(
attr_len
);
}
kaddr
=
kmap_atomic
(
page
,
KM_USER0
);
/* Copy the data from the page to the mft record. */
memcpy
((
u8
*
)
ctx
->
attr
+
le16_to_cpu
(
ctx
->
attr
->
data
.
resident
.
value_offset
),
...
...
@@ -1831,7 +1828,7 @@ static int ntfs_prepare_write(struct file *file, struct page *page,
unsigned
from
,
unsigned
to
)
{
s64
new_size
;
unsigned
long
flags
;
loff_t
i_size
;
struct
inode
*
vi
=
page
->
mapping
->
host
;
ntfs_inode
*
base_ni
=
NULL
,
*
ni
=
NTFS_I
(
vi
);
ntfs_volume
*
vol
=
ni
->
vol
;
...
...
@@ -1934,13 +1931,11 @@ static int ntfs_prepare_write(struct file *file, struct page *page,
/* The total length of the attribute value. */
attr_len
=
le32_to_cpu
(
a
->
data
.
resident
.
value_length
);
/* Fix an eventual previous failure of ntfs_commit_write(). */
read_lock_irqsave
(
&
ni
->
size_lock
,
flags
);
if
(
unlikely
(
ni
->
initialized_size
<
attr_len
))
{
attr_len
=
ni
->
initialized
_size
;
i_size
=
i_size_read
(
vi
);
if
(
unlikely
(
attr_len
>
i_size
))
{
attr_len
=
i
_size
;
a
->
data
.
resident
.
value_length
=
cpu_to_le32
(
attr_len
);
BUG_ON
(
attr_len
<
i_size_read
(
vi
));
}
read_unlock_irqrestore
(
&
ni
->
size_lock
,
flags
);
/* If we do not need to resize the attribute allocation we are done. */
if
(
new_size
<=
attr_len
)
goto
done_unm
;
...
...
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