mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 14:14:24 +08:00
affs_do_readpage_ofs(): just use kmap_atomic() around memcpy()
It forgets kunmap() on a failure exit, but there's really no point keeping the page kmapped at all - after all, what we are doing is a bunch of memcpy() into the parts of page, so kmap_atomic()/kunmap_atomic() just around those memcpy() is enough. Spotted-by: Insu Yun <wuninsu@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
0e9a7da51b
commit
0bacbe528e
@ -511,8 +511,6 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
|
||||
pr_debug("%s(%lu, %ld, 0, %d)\n", __func__, inode->i_ino,
|
||||
page->index, to);
|
||||
BUG_ON(to > PAGE_CACHE_SIZE);
|
||||
kmap(page);
|
||||
data = page_address(page);
|
||||
bsize = AFFS_SB(sb)->s_data_blksize;
|
||||
tmp = page->index << PAGE_CACHE_SHIFT;
|
||||
bidx = tmp / bsize;
|
||||
@ -524,14 +522,15 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
|
||||
return PTR_ERR(bh);
|
||||
tmp = min(bsize - boff, to - pos);
|
||||
BUG_ON(pos + tmp > to || tmp > bsize);
|
||||
data = kmap_atomic(page);
|
||||
memcpy(data + pos, AFFS_DATA(bh) + boff, tmp);
|
||||
kunmap_atomic(data);
|
||||
affs_brelse(bh);
|
||||
bidx++;
|
||||
pos += tmp;
|
||||
boff = 0;
|
||||
}
|
||||
flush_dcache_page(page);
|
||||
kunmap(page);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user