本文整理汇总了C++中end_page_writeback函数的典型用法代码示例。如果您正苦于以下问题:C++ end_page_writeback函数的具体用法?C++ end_page_writeback怎么用?C++ end_page_writeback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了end_page_writeback函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rawfs_writepage
static int rawfs_writepage(struct page *page, struct writeback_control *wbc)
{
struct address_space *mapping = page->mapping;
struct inode *inode;
unsigned long end_index;
char *buffer;
int n_written = 0;
unsigned n_bytes;
loff_t i_size;
if (!mapping)
BUG();
inode = mapping->host;
if (!inode)
BUG();
i_size = i_size_read(inode);
end_index = i_size >> PAGE_CACHE_SHIFT;
if (page->index < end_index)
n_bytes = PAGE_CACHE_SIZE;
else {
n_bytes = i_size & (PAGE_CACHE_SIZE - 1);
if (page->index > end_index || !n_bytes) {
zero_user_segment(page, 0, PAGE_CACHE_SIZE);
set_page_writeback(page);
unlock_page(page);
end_page_writeback(page);
return 0;
}
}
if (n_bytes != PAGE_CACHE_SIZE)
zero_user_segment(page, n_bytes, PAGE_CACHE_SIZE);
get_page(page);
buffer = kmap(page);
/* n_written = yaffs_wr_file(obj, buffer,
page->index << PAGE_CACHE_SHIFT, n_bytes, 0);
*/
n_written = rawfs_write_file(inode, buffer, n_bytes,
page->index << PAGE_CACHE_SHIFT);
kunmap(page);
set_page_writeback(page);
unlock_page(page);
end_page_writeback(page);
put_page(page);
return (n_written == n_bytes) ? 0 : -ENOSPC;
}
开发者ID:4Fwolf,项目名称:motorola-hawk-kernel-3.4.67,代码行数:55,代码来源:file.c
示例2: f2fs_write_end_io
static void f2fs_write_end_io(struct bio *bio)
{
struct f2fs_sb_info *sbi = bio->bi_private;
struct bio_vec *bvec;
int i;
bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;
f2fs_restore_and_release_control_page(&page);
if (unlikely(bio->bi_error)) {
set_page_dirty(page);
set_bit(AS_EIO, &page->mapping->flags);
f2fs_stop_checkpoint(sbi);
}
end_page_writeback(page);
dec_page_count(sbi, F2FS_WRITEBACK);
}
if (!get_pages(sbi, F2FS_WRITEBACK) &&
!list_empty(&sbi->cp_wait.task_list))
wake_up(&sbi->cp_wait);
bio_put(bio);
}
开发者ID:aejsmith,项目名称:linux,代码行数:26,代码来源:data.c
示例3: gfs2_aspace_writepage
static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
{
int err;
struct buffer_head *bh, *head;
int nr_underway = 0;
int write_op = (1 << BIO_RW_META) | ((wbc->sync_mode == WB_SYNC_ALL ?
WRITE_SYNC_PLUG : WRITE));
BUG_ON(!PageLocked(page));
BUG_ON(!page_has_buffers(page));
head = page_buffers(page);
bh = head;
do {
if (!buffer_mapped(bh))
continue;
/*
* If it's a fully non-blocking write attempt and we cannot
* lock the buffer then redirty the page. Note that this can
* potentially cause a busy-wait loop from pdflush and kswapd
* activity, but those code paths have their own higher-level
* throttling.
*/
if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) {
lock_buffer(bh);
} else if (!trylock_buffer(bh)) {
redirty_page_for_writepage(wbc, page);
continue;
}
if (test_clear_buffer_dirty(bh)) {
mark_buffer_async_write(bh);
} else {
unlock_buffer(bh);
}
} while ((bh = bh->b_this_page) != head);
/*
* The page and its buffers are protected by PageWriteback(), so we can
* drop the bh refcounts early.
*/
BUG_ON(PageWriteback(page));
set_page_writeback(page);
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
submit_bh(write_op, bh);
nr_underway++;
}
bh = next;
} while (bh != head);
unlock_page(page);
err = 0;
if (nr_underway == 0)
end_page_writeback(page);
return err;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:60,代码来源:meta_io.c
示例4: swap_writepage
/*
* We may have stale swap cache pages in memory: notice
* them here and get rid of the unnecessary final write.
*/
int swap_writepage(struct page *page, struct writeback_control *wbc)
{
struct bio *bio;
int ret = 0, rw = WRITE;
if (try_to_free_swap(page)) {
unlock_page(page);
goto out;
}
#ifdef CONFIG_FRONTSWAP
if (frontswap_store(page) == 0) {
set_page_writeback(page);
unlock_page(page);
end_page_writeback(page);
goto out;
}
#endif
bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
if (bio == NULL) {
set_page_dirty(page);
unlock_page(page);
ret = -ENOMEM;
goto out;
}
if (wbc->sync_mode == WB_SYNC_ALL)
rw |= REQ_SYNC;
count_vm_event(PSWPOUT);
set_page_writeback(page);
unlock_page(page);
submit_bio(rw, bio);
out:
return ret;
}
开发者ID:xdatravelbug,项目名称:android_kernel_sony_msm8974,代码行数:37,代码来源:page_io.c
示例5: mpage_end_io
/*
* I/O completion handler for multipage BIOs.
*
* The mpage code never puts partial pages into a BIO (except for end-of-file).
* If a page does not map to a contiguous run of blocks then it simply falls
* back to block_read_full_page().
*
* Why is this? If a page's completion depends on a number of different BIOs
* which can complete in any order (or at the same time) then determining the
* status of that page is hard. See end_buffer_async_read() for the details.
* There is no point in duplicating all that complexity.
*/
static void mpage_end_io(struct bio *bio, int err)
{
const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
do {
struct page *page = bvec->bv_page;
if (--bvec >= bio->bi_io_vec)
prefetchw(&bvec->bv_page->flags);
if (bio_data_dir(bio) == READ) {
if (uptodate) {
SetPageUptodate(page);
} else {
ClearPageUptodate(page);
SetPageError(page);
}
unlock_page(page);
} else { /* bio_data_dir(bio) == WRITE */
if (!uptodate) {
SetPageError(page);
if (page->mapping)
set_bit(AS_EIO, &page->mapping->flags);
}
end_page_writeback(page);
}
} while (bvec >= bio->bi_io_vec);
bio_put(bio);
}
开发者ID:kgdhost,项目名称:kernel-lge-e400-stock,代码行数:41,代码来源:mpage.c
示例6: ext4_finish_bio
static void ext4_finish_bio(struct bio *bio)
{
int i;
struct bio_vec *bvec;
bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;
#ifdef CONFIG_EXT4_FS_ENCRYPTION
struct page *data_page = NULL;
#endif
struct buffer_head *bh, *head;
unsigned bio_start = bvec->bv_offset;
unsigned bio_end = bio_start + bvec->bv_len;
unsigned under_io = 0;
unsigned long flags;
if (!page)
continue;
#ifdef CONFIG_EXT4_FS_ENCRYPTION
if (!page->mapping) {
/* The bounce data pages are unmapped. */
data_page = page;
fscrypt_pullback_bio_page(&page, false);
}
#endif
if (bio->bi_error) {
SetPageError(page);
mapping_set_error(page->mapping, -EIO);
}
bh = head = page_buffers(page);
/*
* We check all buffers in the page under BH_Uptodate_Lock
* to avoid races with other end io clearing async_write flags
*/
local_irq_save(flags);
bit_spin_lock(BH_Uptodate_Lock, &head->b_state);
do {
if (bh_offset(bh) < bio_start ||
bh_offset(bh) + bh->b_size > bio_end) {
if (buffer_async_write(bh))
under_io++;
continue;
}
clear_buffer_async_write(bh);
if (bio->bi_error)
buffer_io_error(bh);
} while ((bh = bh->b_this_page) != head);
bit_spin_unlock(BH_Uptodate_Lock, &head->b_state);
local_irq_restore(flags);
if (!under_io) {
#ifdef CONFIG_EXT4_FS_ENCRYPTION
if (data_page)
fscrypt_restore_control_page(data_page);
#endif
end_page_writeback(page);
}
}
}
开发者ID:acton393,项目名称:linux,代码行数:60,代码来源:page-io.c
示例7: put_io_page
static void put_io_page(struct ext4_io_page *io_page)
{
if (atomic_dec_and_test(&io_page->p_count)) {
end_page_writeback(io_page->p_page);
put_page(io_page->p_page);
kmem_cache_free(io_page_cachep, io_page);
}
}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:8,代码来源:page-io.c
示例8: nfs_end_page_writeback
static void nfs_end_page_writeback(struct page *page)
{
struct inode *inode = page->mapping->host;
struct nfs_server *nfss = NFS_SERVER(inode);
end_page_writeback(page);
if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)
clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC);
}
开发者ID:friackazoid,项目名称:linux-2.6,代码行数:9,代码来源:write.c
示例9: writeseg_end_io
static void writeseg_end_io(struct bio *bio)
{
struct bio_vec *bvec;
int i;
struct super_block *sb = bio->bi_private;
struct logfs_super *super = logfs_super(sb);
BUG_ON(bio->bi_error); /* FIXME: Retry io or write elsewhere */
bio_for_each_segment_all(bvec, bio, i) {
end_page_writeback(bvec->bv_page);
page_cache_release(bvec->bv_page);
}
开发者ID:DenisLug,项目名称:mptcp,代码行数:13,代码来源:dev_bdev.c
示例10: ecryptfs_writepage_complete
/**
* ecryptfs_writepage_complete
* @page_crypt_req: The encrypt page request that completed
*
* Calls when the requested page has been encrypted and written to the lower
* file system.
*/
static void ecryptfs_writepage_complete(
struct ecryptfs_page_crypt_req *page_crypt_req)
{
struct page *page = page_crypt_req->page;
int rc;
rc = atomic_read(&page_crypt_req->rc);
if (unlikely(rc)) {
ecryptfs_printk(KERN_WARNING, "Error encrypting "
"page (upper index [0x%.16lx])\n", page->index);
ClearPageUptodate(page);
SetPageError(page);
} else {
SetPageUptodate(page);
}
end_page_writeback(page);
ecryptfs_free_page_crypt_req(page_crypt_req);
}
开发者ID:daeiron,项目名称:LG_G3_Kernel,代码行数:24,代码来源:mmap.c
示例11: ext4_finish_bio
static void ext4_finish_bio(struct bio *bio)
{
int i;
int error = !test_bit(BIO_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec;
bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;
struct buffer_head *bh, *head;
unsigned bio_start = bvec->bv_offset;
unsigned bio_end = bio_start + bvec->bv_len;
unsigned under_io = 0;
unsigned long flags;
if (!page)
continue;
if (error) {
SetPageError(page);
set_bit(AS_EIO, &page->mapping->flags);
}
bh = head = page_buffers(page);
/*
* We check all buffers in the page under BH_Uptodate_Lock
* to avoid races with other end io clearing async_write flags
*/
local_irq_save(flags);
bit_spin_lock(BH_Uptodate_Lock, &head->b_state);
do {
if (bh_offset(bh) < bio_start ||
bh_offset(bh) + bh->b_size > bio_end) {
if (buffer_async_write(bh))
under_io++;
continue;
}
clear_buffer_async_write(bh);
if (error)
buffer_io_error(bh);
} while ((bh = bh->b_this_page) != head);
bit_spin_unlock(BH_Uptodate_Lock, &head->b_state);
local_irq_restore(flags);
if (!under_io)
end_page_writeback(page);
}
}
开发者ID:MichaelTong,项目名称:linux-kernel,代码行数:45,代码来源:page-io.c
示例12: mpage_end_io_write
static void mpage_end_io_write(struct bio *bio, int err)
{
const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
do {
struct page *page = bvec->bv_page;
if (--bvec >= bio->bi_io_vec)
prefetchw(&bvec->bv_page->flags);
if (!uptodate){
if (page->mapping)
set_bit(AS_EIO, &page->mapping->flags);
}
end_page_writeback(page);
} while (bvec >= bio->bi_io_vec);
bio_put(bio);
}
开发者ID:3null,项目名称:fastsocket,代码行数:19,代码来源:mpage.c
示例13: writeseg_end_io
static void writeseg_end_io(struct bio *bio, int err)
{
const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
struct super_block *sb = bio->bi_private;
struct logfs_super *super = logfs_super(sb);
struct page *page;
BUG_ON(!uptodate); /* FIXME: Retry io or write elsewhere */
BUG_ON(err);
BUG_ON(bio->bi_vcnt == 0);
do {
page = bvec->bv_page;
if (--bvec >= bio->bi_io_vec)
prefetchw(&bvec->bv_page->flags);
end_page_writeback(page);
page_cache_release(page);
} while (bvec >= bio->bi_io_vec);
bio_put(bio);
if (atomic_dec_and_test(&super->s_pending_writes))
wake_up(&wq);
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:23,代码来源:dev_bdev.c
示例14: afs_kill_pages
/*
* kill all the pages in the given range
*/
static void afs_kill_pages(struct address_space *mapping,
pgoff_t first, pgoff_t last)
{
struct afs_vnode *vnode = AFS_FS_I(mapping->host);
struct pagevec pv;
unsigned count, loop;
_enter("{%x:%u},%lx-%lx",
vnode->fid.vid, vnode->fid.vnode, first, last);
pagevec_init(&pv);
do {
_debug("kill %lx-%lx", first, last);
count = last - first + 1;
if (count > PAGEVEC_SIZE)
count = PAGEVEC_SIZE;
pv.nr = find_get_pages_contig(mapping, first, count, pv.pages);
ASSERTCMP(pv.nr, ==, count);
for (loop = 0; loop < count; loop++) {
struct page *page = pv.pages[loop];
ClearPageUptodate(page);
SetPageError(page);
end_page_writeback(page);
if (page->index >= first)
first = page->index + 1;
lock_page(page);
generic_error_remove_page(mapping, page);
}
__pagevec_release(&pv);
} while (first <= last);
_leave("");
}
开发者ID:krzk,项目名称:linux,代码行数:40,代码来源:write.c
示例15: afs_redirty_pages
/*
* Redirty all the pages in a given range.
*/
static void afs_redirty_pages(struct writeback_control *wbc,
struct address_space *mapping,
pgoff_t first, pgoff_t last)
{
struct afs_vnode *vnode = AFS_FS_I(mapping->host);
struct pagevec pv;
unsigned count, loop;
_enter("{%x:%u},%lx-%lx",
vnode->fid.vid, vnode->fid.vnode, first, last);
pagevec_init(&pv);
do {
_debug("redirty %lx-%lx", first, last);
count = last - first + 1;
if (count > PAGEVEC_SIZE)
count = PAGEVEC_SIZE;
pv.nr = find_get_pages_contig(mapping, first, count, pv.pages);
ASSERTCMP(pv.nr, ==, count);
for (loop = 0; loop < count; loop++) {
struct page *page = pv.pages[loop];
redirty_page_for_writepage(wbc, page);
end_page_writeback(page);
if (page->index >= first)
first = page->index + 1;
}
__pagevec_release(&pv);
} while (first <= last);
_leave("");
}
开发者ID:krzk,项目名称:linux,代码行数:39,代码来源:write.c
示例16: end_swap_bio_write
void end_swap_bio_write(struct bio *bio)
{
struct page *page = bio->bi_io_vec[0].bv_page;
if (bio->bi_error) {
SetPageError(page);
/*
* We failed to write the page out to swap-space.
* Re-dirty the page in order to avoid it being reclaimed.
* Also print a dire warning that things will go BAD (tm)
* very quickly.
*
* Also clear PG_reclaim to avoid rotate_reclaimable_page()
*/
set_page_dirty(page);
pr_alert("Write-error on swap-device (%u:%u:%llu)\n",
imajor(bio->bi_bdev->bd_inode),
iminor(bio->bi_bdev->bd_inode),
(unsigned long long)bio->bi_iter.bi_sector);
ClearPageReclaim(page);
}
end_page_writeback(page);
bio_put(bio);
}
开发者ID:oldzhu,项目名称:linux,代码行数:24,代码来源:page_io.c
示例17: ntfs_mft_writepage
//.........这里部分代码省略.........
}
/* Skip the mft record if it is a base inode. */
if (!m->base_mft_record) {
ntfs_debug("Mft record 0x%lx is a base record, "
"continuing search.", mft_no);
continue;
}
/*
* This is an extent mft record. Check if the inode
* corresponding to its base mft record is in icache.
*/
na.mft_no = MREF_LE(m->base_mft_record);
ntfs_debug("Mft record 0x%lx is an extent record. Looking "
"for base inode 0x%lx in icache.", mft_no,
na.mft_no);
vi = ilookup5(sb, na.mft_no, (test_t)ntfs_test_inode,
&na);
if (!vi) {
/*
* The base inode is not in icache. Skip this extent
* mft record.
*/
ntfs_debug("Base inode 0x%lx is not in icache, "
"continuing search.", na.mft_no);
continue;
}
ntfs_debug("Base inode 0x%lx is in icache.", na.mft_no);
/*
* The base inode is in icache. Check if it has the extent
* inode corresponding to this extent mft record attached.
*/
ni = NTFS_I(vi);
down(&ni->extent_lock);
if (ni->nr_extents <= 0) {
/*
* The base inode has no attached extent inodes. Skip
* this extent mft record.
*/
up(&ni->extent_lock);
iput(vi);
continue;
}
/* Iterate over the attached extent inodes. */
extent_nis = ni->ext.extent_ntfs_inos;
for (eni = NULL, j = 0; j < ni->nr_extents; ++j) {
if (mft_no == extent_nis[j]->mft_no) {
/*
* Found the extent inode corresponding to this
* extent mft record.
*/
eni = extent_nis[j];
break;
}
}
/*
* If the extent inode was not attached to the base inode, skip
* this extent mft record.
*/
if (!eni) {
up(&ni->extent_lock);
iput(vi);
continue;
}
/*
* Found the extent inode corrsponding to this extent mft
* record. If it is dirty, no need to search further.
*/
if (NInoDirty(eni)) {
up(&ni->extent_lock);
iput(vi);
is_dirty = TRUE;
break;
}
/* The extent inode is not dirty, so do the next record. */
up(&ni->extent_lock);
iput(vi);
}
kunmap(page);
/* If a dirty mft record was found, redirty the page. */
if (is_dirty) {
ntfs_debug("Inode 0x%lx is dirty. Redirtying the page "
"starting at inode 0x%lx.", mft_no,
page->index << (PAGE_CACHE_SHIFT -
vol->mft_record_size_bits));
redirty_page_for_writepage(wbc, page);
unlock_page(page);
} else {
/*
* Keep the VM happy. This must be done otherwise the
* radix-tree tag PAGECACHE_TAG_DIRTY remains set even though
* the page is clean.
*/
BUG_ON(PageWriteback(page));
set_page_writeback(page);
unlock_page(page);
end_page_writeback(page);
}
ntfs_debug("Done.");
return 0;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:101,代码来源:mft.c
注:本文中的end_page_writeback函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论