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
10794d14
Commit
10794d14
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- pre4:
- truncate really fixed this time. Everybody agrees.
parent
3db9dee5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
26 deletions
+25
-26
drivers/sound/nm256_audio.c
drivers/sound/nm256_audio.c
+1
-1
fs/buffer.c
fs/buffer.c
+8
-19
fs/ext2/inode.c
fs/ext2/inode.c
+1
-2
include/linux/fs.h
include/linux/fs.h
+15
-4
No files found.
drivers/sound/nm256_audio.c
View file @
10794d14
...
...
@@ -1467,7 +1467,7 @@ nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg)
break
;
case
SNDCTL_DSP_SETFMT
:
if
(
get_user
(
ret
,
(
int
*
)
arg
)
if
(
get_user
(
ret
,
(
int
*
)
arg
)
)
return
-
EFAULT
;
if
(
ret
!=
0
)
{
...
...
fs/buffer.c
View file @
10794d14
...
...
@@ -1514,6 +1514,9 @@ static int __block_commit_write(struct inode *inode, struct page *page,
bh
!=
head
||
!
block_start
;
block_start
=
block_end
,
bh
=
bh
->
b_this_page
)
{
block_end
=
block_start
+
blocksize
;
/* This can happen for the truncate case */
if
(
!
buffer_mapped
(
bh
))
continue
;
if
(
block_end
<=
from
||
block_start
>=
to
)
{
if
(
!
buffer_uptodate
(
bh
))
partial
=
1
;
...
...
@@ -1721,24 +1724,12 @@ int generic_commit_write(struct file *file, struct page *page,
return
0
;
}
/*
* If it would be '74 that would go into libc...
*/
int
mem_is_zero
(
char
*
p
,
unsigned
len
)
{
while
(
len
--
)
if
(
*
p
++
)
return
0
;
return
1
;
}
int
block_zero_page
(
struct
address_space
*
mapping
,
loff_t
from
,
unsigned
length
)
{
unsigned
long
index
=
from
>>
PAGE_CACHE_SHIFT
;
unsigned
offset
=
from
&
(
PAGE_CACHE_SIZE
-
1
);
struct
inode
*
inode
=
(
struct
inode
*
)
mapping
->
host
;
struct
page
*
page
;
char
*
kaddr
;
int
err
;
if
(
!
length
)
...
...
@@ -1747,21 +1738,19 @@ int block_zero_page(struct address_space *mapping, loff_t from, unsigned length)
page
=
read_cache_page
(
mapping
,
index
,
(
filler_t
*
)
mapping
->
a_ops
->
readpage
,
NULL
);
err
=
PTR_ERR
(
page
);
if
(
ERR_PT
R
(
page
))
if
(
IS_ER
R
(
page
))
goto
out
;
lock_page
(
page
);
err
=
-
EIO
;
if
(
!
Page_Uptodate
(
page
))
goto
unlock
;
kaddr
=
(
char
*
)
kmap
(
page
);
err
=
0
;
if
(
mem_is_zero
(
kaddr
+
offset
,
length
))
goto
unmap
;
memset
(
kaddr
+
offset
,
0
,
length
);
memset
((
char
*
)
kmap
(
page
)
+
offset
,
0
,
length
);
flush_dcache_page
(
page
);
__block_commit_write
(
inode
,
page
,
offset
,
offset
+
length
);
unmap:
kunmap
(
page
);
err
=
0
;
unlock:
UnlockPage
(
page
);
page_cache_release
(
page
);
...
...
fs/ext2/inode.c
View file @
10794d14
...
...
@@ -919,8 +919,7 @@ void ext2_truncate (struct inode * inode)
>>
EXT2_BLOCK_SIZE_BITS
(
inode
->
i_sb
);
tail
=
(
iblock
<<
EXT2_BLOCK_SIZE_BITS
(
inode
->
i_sb
))
-
inode
->
i_size
;
if
(
block_zero_page
(
inode
->
i_mapping
,
inode
->
i_size
,
tail
)
!=
0
)
return
;
block_zero_page
(
inode
->
i_mapping
,
inode
->
i_size
,
tail
);
n
=
ext2_block_to_path
(
inode
,
iblock
,
offsets
);
if
(
n
==
0
)
...
...
include/linux/fs.h
View file @
10794d14
...
...
@@ -1050,9 +1050,20 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *);
* This should be a per-architecture thing, to allow different
* error and pointer decisions.
*/
#define ERR_PTR(err) ((void *)((long)(err)))
#define PTR_ERR(ptr) ((long)(ptr))
#define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)(-1000))
static
inline
void
*
ERR_PTR
(
long
error
)
{
return
(
void
*
)
error
;
}
static
inline
long
PTR_ERR
(
const
void
*
ptr
)
{
return
(
long
)
ptr
;
}
static
inline
long
IS_ERR
(
const
void
*
ptr
)
{
return
(
unsigned
long
)
ptr
>
(
unsigned
long
)
-
1000L
;
}
/*
* The bitmask for a lookup event:
...
...
@@ -1162,7 +1173,7 @@ extern int block_sync_page(struct page *);
int
generic_block_bmap
(
struct
address_space
*
,
long
,
get_block_t
*
);
int
generic_commit_write
(
struct
file
*
,
struct
page
*
,
unsigned
,
unsigned
);
int
block_zero_page
(
struct
address_space
*
mapping
,
loff_t
,
unsigned
);
int
block_zero_page
(
struct
address_space
*
,
loff_t
,
unsigned
);
extern
int
generic_file_mmap
(
struct
file
*
,
struct
vm_area_struct
*
);
extern
ssize_t
generic_file_read
(
struct
file
*
,
char
*
,
size_t
,
loff_t
*
);
...
...
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