当前位置: 首页>>代码示例>>C++>>正文


C++ buffer_jbd函数代码示例

本文整理汇总了C++中buffer_jbd函数的典型用法代码示例。如果您正苦于以下问题:C++ buffer_jbd函数的具体用法?C++ buffer_jbd怎么用?C++ buffer_jbd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了buffer_jbd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: jbd_preclean_buffer_check

void jbd_preclean_buffer_check(struct buffer_head *bh)
{
	if (buffer_jbd(bh)) {
	struct journal_head *jh = bh2jh(bh);

	transaction_t *transaction = jh->b_transaction;
	journal_t *journal;

	if (jh->b_jlist == 0 && transaction == NULL)
	return;

	J_ASSERT_JH(jh, transaction != NULL);
	/* The kernel may be unmapping old data. We expect it
	* to be dirty in that case, unless the buffer has
	* already been forgotten by a transaction. */
	if (jh->b_jlist != BJ_Forget) {
#if 1
	if (!buffer_dirty(bh)) {
	printk("%s: clean of clean buffer\n",
	__FUNCTION__);
	print_buffer_trace(bh);
	return;
	}
#endif
	J_ASSERT_BH(bh, buffer_dirty(bh));
	}

	journal = transaction->t_journal;
	J_ASSERT_JH(jh,
	transaction == journal->j_running_transaction ||
	transaction == journal->j_committing_transaction);
	}
}
开发者ID:huwan,项目名称:linux-buffer-debug,代码行数:33,代码来源:jbd2-kernel.c

示例2: print_buffer_fields

void print_buffer_fields(struct buffer_head *bh)
{
	printk("b_next:%p, b_blocknr:%lu b_count:%d b_flushtime:%lu\n",
		bh->b_next, bh->b_blocknr, atomic_read(&bh->b_count),
			bh->b_flushtime);
	printk("b_next_free:%p b_prev_free:%p b_this_page:%p b_reqnext:%p\n",
		bh->b_next_free, bh->b_prev_free, bh->b_this_page,
			bh->b_reqnext);
	printk("b_pprev:%p b_data:%p b_page:%p b_inode:%p b_list:%d\n",
		bh->b_pprev, bh->b_data, bh->b_page, bh->b_inode, bh->b_list);
#if defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE)
	if (buffer_jbd(bh)) {
		struct journal_head *jh = bh2jh(bh);

		printk("b_jlist:%u b_frozen_data:%p b_committed_data:%p\n",
			jh->b_jlist, jh->b_frozen_data, jh->b_committed_data);
		printk(" b_transaction:%p b_next_transaction:%p "
				"b_cp_transaction:%p\n",
			jh->b_transaction, jh->b_next_transaction,
			jh->b_cp_transaction);
		printk("b_cpnext:%p b_cpprev:%p\n",
			jh->b_cpnext, jh->b_cpprev);
	}
#endif
}
开发者ID:liuxueyang,项目名称:Linux-Unix,代码行数:25,代码来源:jbd-kernel.c

示例3: jbd2_journal_try_to_free_buffers

int jbd2_journal_try_to_free_buffers(journal_t *journal,
				struct page *page, gfp_t gfp_mask)
{
	struct buffer_head *head;
	struct buffer_head *bh;
	int ret = 0;

	J_ASSERT(PageLocked(page));

	head = page_buffers(page);
	bh = head;
	do {
		struct journal_head *jh;

		jh = jbd2_journal_grab_journal_head(bh);
		if (!jh)
			continue;

		jbd_lock_bh_state(bh);
		__journal_try_to_free_buffer(journal, bh);
		jbd2_journal_put_journal_head(jh);
		jbd_unlock_bh_state(bh);
		if (buffer_jbd(bh))
			goto busy;
	} while ((bh = bh->b_this_page) != head);

	ret = try_to_free_buffers(page);

busy:
	return ret;
}
开发者ID:Albinoman887,项目名称:pyramid-3.4.10,代码行数:31,代码来源:transaction.c

示例4: jbd_lock_bh_journal_head

/*
 * Grab a ref against this buffer_head's journal_head.  If it ended up not
 * having a journal_head, return NULL
 */
struct journal_head *journal_grab_journal_head(struct buffer_head *bh)
{
    struct journal_head *jh = NULL;

    jbd_lock_bh_journal_head(bh);
    if (buffer_jbd(bh)) {
        jh = bh2jh(bh);
        jh->b_jcount++;
    }
    jbd_unlock_bh_journal_head(bh);
    return jh;
}
开发者ID:Axure,项目名称:Ext3Fsd,代码行数:16,代码来源:replay.c

示例5: ocfs2_test_bg_bit_allocatable

/*
 * More or less lifted from ext3. I'll leave their description below:
 *
 * "For ext3 allocations, we must not reuse any blocks which are
 * allocated in the bitmap buffer's "last committed data" copy.  This
 * prevents deletes from freeing up the page for reuse until we have
 * committed the delete transaction.
 *
 * If we didn't do this, then deleting something and reallocating it as
 * data would allow the old block to be overwritten before the
 * transaction committed (because we force data to disk before commit).
 * This would lead to corruption if we crashed between overwriting the
 * data and committing the delete.
 *
 * @@@ We may want to make this allocation behaviour conditional on
 * data-writes at some point, and disable it for metadata allocations or
 * sync-data inodes."
 *
 * Note: OCFS2 already does this differently for metadata vs data
 * allocations, as those bitmaps are seperate and undo access is never
 * called on a metadata group descriptor.
 */
static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh,
					 int nr)
{
	struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data;

	if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap))
		return 0;
	if (!buffer_jbd(bg_bh) || !bh2jh(bg_bh)->b_committed_data)
		return 1;

	bg = (struct ocfs2_group_desc *) bh2jh(bg_bh)->b_committed_data;
	return !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap);
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:35,代码来源:suballoc.c

示例6: journal_alloc_journal_head

/*
 * Give a buffer_head a journal_head.
 *
 * Doesn't need the journal lock.
 * May sleep.
 */
struct journal_head *journal_add_journal_head(struct buffer_head *bh)
{
    struct journal_head *jh;
    struct journal_head *new_jh = NULL;

repeat:
    if (!buffer_jbd(bh)) {
        new_jh = journal_alloc_journal_head();
        memset(new_jh, 0, sizeof(*new_jh));
    }

    jbd_lock_bh_journal_head(bh);
    if (buffer_jbd(bh)) {
        jh = bh2jh(bh);
    } else {
        J_ASSERT_BH(bh,
                    (atomic_read(&bh->b_count) > 0) ||
                    (bh->b_page && bh->b_page->mapping));

        if (!new_jh) {
            jbd_unlock_bh_journal_head(bh);
            goto repeat;
        }

        jh = new_jh;
        new_jh = NULL;		/* We consumed it */
        set_buffer_jbd(bh);
        bh->b_private = jh;
        jh->b_bh = bh;
        get_bh(bh);
        BUFFER_TRACE(bh, "added journal_head");
    }
    jh->b_jcount++;
    jbd_unlock_bh_journal_head(bh);
    if (new_jh)
        journal_free_journal_head(new_jh);
    return bh->b_private;
}
开发者ID:Axure,项目名称:Ext3Fsd,代码行数:44,代码来源:replay.c

示例7: ocfs2_write_block

int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
		      struct inode *inode)
{
	int ret = 0;

	mlog_entry("(bh->b_blocknr = %llu, inode=%p)\n",
		   (unsigned long long)bh->b_blocknr, inode);

	BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO);
	BUG_ON(buffer_jbd(bh));

	/* No need to check for a soft readonly file system here. non
	 * journalled writes are only ever done on system files which
	 * can get modified during recovery even if read-only. */
	if (ocfs2_is_hard_readonly(osb)) {
		ret = -EROFS;
		goto out;
	}

	mutex_lock(&OCFS2_I(inode)->ip_io_mutex);

	lock_buffer(bh);
	set_buffer_uptodate(bh);

	/* remove from dirty list before I/O. */
	clear_buffer_dirty(bh);

	get_bh(bh); /* for end_buffer_write_sync() */
	bh->b_end_io = end_buffer_write_sync;
	submit_bh(WRITE, bh);

	wait_on_buffer(bh);

	if (buffer_uptodate(bh)) {
		ocfs2_set_buffer_uptodate(inode, bh);
	} else {
		/* We don't need to remove the clustered uptodate
		 * information for this bh as it's not marked locally
		 * uptodate. */
		ret = -EIO;
		put_bh(bh);
	}

	mutex_unlock(&OCFS2_I(inode)->ip_io_mutex);
out:
	mlog_exit(ret);
	return ret;
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:48,代码来源:buffer_head_io.c

示例8: ocfs2_write_block

int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
		      struct ocfs2_caching_info *ci)
{
	int ret = 0;

	trace_ocfs2_write_block((unsigned long long)bh->b_blocknr, ci);

	BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO);
	BUG_ON(buffer_jbd(bh));

	/* No need to check for a soft readonly file system here. non
	 * journalled writes are only ever done on system files which
	 * can get modified during recovery even if read-only. */
	if (ocfs2_is_hard_readonly(osb)) {
		ret = -EROFS;
		mlog_errno(ret);
		goto out;
	}

	ocfs2_metadata_cache_io_lock(ci);

	lock_buffer(bh);
	set_buffer_uptodate(bh);

	/* remove from dirty list before I/O. */
	clear_buffer_dirty(bh);

	get_bh(bh); /* for end_buffer_write_sync() */
	bh->b_end_io = end_buffer_write_sync;
	submit_bh(REQ_OP_WRITE, 0, bh);

	wait_on_buffer(bh);

	if (buffer_uptodate(bh)) {
		ocfs2_set_buffer_uptodate(ci, bh);
	} else {
		/* We don't need to remove the clustered uptodate
		 * information for this bh as it's not marked locally
		 * uptodate. */
		ret = -EIO;
		mlog_errno(ret);
	}

	ocfs2_metadata_cache_io_unlock(ci);
out:
	return ret;
}
开发者ID:AK101111,项目名称:linux,代码行数:47,代码来源:buffer_head_io.c

示例9: ocfs2_buffer_uptodate

/* Warning: even if it returns true, this does *not* guarantee that
 * the block is stored in our inode metadata cache. 
 * 
 * This can be called under lock_buffer()
 */
int ocfs2_buffer_uptodate(struct inode *inode,
			  struct buffer_head *bh)
{
	/* Doesn't matter if the bh is in our cache or not -- if it's
	 * not marked uptodate then we know it can't have correct
	 * data. */
	if (!buffer_uptodate(bh))
		return 0;

	/* OCFS2 does not allow multiple nodes to be changing the same
	 * block at the same time. */
	if (buffer_jbd(bh))
		return 1;

	/* Ok, locally the buffer is marked as up to date, now search
	 * our cache to see if we can trust that. */
	return ocfs2_buffer_cached(OCFS2_I(inode), bh);
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:23,代码来源:uptodate.c

示例10: print_buffer_fields

void print_buffer_fields(struct buffer_head *bh)
{
	printk("b_blocknr:%llu b_count:%d\n",
	(unsigned long long)bh->b_blocknr, atomic_read(&bh->b_count));
	printk("b_this_page:%p b_data:%p b_page:%p\n",
	bh->b_this_page, bh->b_data, bh->b_page);
#if defined(CONFIG_JBD2) || defined(CONFIG_JBD2_MODULE)
	if (buffer_jbd(bh)) {
	struct journal_head *jh = bh2jh(bh);

	printk("b_jlist:%u b_frozen_data:%p b_committed_data:%p\n",
	jh->b_jlist, jh->b_frozen_data, jh->b_committed_data);
	printk(" b_transaction:%p b_next_transaction:%p "
	"b_cp_transaction:%p\n",
	jh->b_transaction, jh->b_next_transaction,
	jh->b_cp_transaction);
	printk("b_cpnext:%p b_cpprev:%p\n",
	jh->b_cpnext, jh->b_cpprev);
	}
#endif
}
开发者ID:huwan,项目名称:linux-buffer-debug,代码行数:21,代码来源:jbd2-kernel.c

示例11: ocfs2_test_bg_bit_allocatable

/*
 * More or less lifted from ext3. I'll leave their description below:
 *
 * "For ext3 allocations, we must not reuse any blocks which are
 * allocated in the bitmap buffer's "last committed data" copy.  This
 * prevents deletes from freeing up the page for reuse until we have
 * committed the delete transaction.
 *
 * If we didn't do this, then deleting something and reallocating it as
 * data would allow the old block to be overwritten before the
 * transaction committed (because we force data to disk before commit).
 * This would lead to corruption if we crashed between overwriting the
 * data and committing the delete.
 *
 * @@@ We may want to make this allocation behaviour conditional on
 * data-writes at some point, and disable it for metadata allocations or
 * sync-data inodes."
 *
 * Note: OCFS2 already does this differently for metadata vs data
 * allocations, as those bitmaps are separate and undo access is never
 * called on a metadata group descriptor.
 */
static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh,
					 int nr)
{
	struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data;
	int ret;

	if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap))
		return 0;

	if (!buffer_jbd(bg_bh))
		return 1;

	jbd_lock_bh_state(bg_bh);
	bg = (struct ocfs2_group_desc *) bh2jh(bg_bh)->b_committed_data;
	if (bg)
		ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap);
	else
		ret = 1;
	jbd_unlock_bh_state(bg_bh);

	return ret;
}
开发者ID:joka90,项目名称:htc-kernel-msm7227,代码行数:44,代码来源:suballoc.c

示例12: __journal_remove_journal_head

static void __journal_remove_journal_head(struct buffer_head *bh)
{
    struct journal_head *jh = bh2jh(bh);

    J_ASSERT_JH(jh, jh->b_jcount >= 0);

    get_bh(bh);
    if (jh->b_jcount == 0) {
        if (jh->b_transaction == NULL &&
                jh->b_next_transaction == NULL &&
                jh->b_cp_transaction == NULL) {
            J_ASSERT_JH(jh, jh->b_jlist == BJ_None);
            J_ASSERT_BH(bh, buffer_jbd(bh));
            J_ASSERT_BH(bh, jh2bh(jh) == bh);
            BUFFER_TRACE(bh, "remove journal_head");
            if (jh->b_frozen_data) {
                printk(KERN_WARNING "%s: freeing "
                       "b_frozen_data\n",
                       __FUNCTION__);
                jbd_free(jh->b_frozen_data, bh->b_size);
            }
            if (jh->b_committed_data) {
                printk(KERN_WARNING "%s: freeing "
                       "b_committed_data\n",
                       __FUNCTION__);
                jbd_free(jh->b_committed_data, bh->b_size);
            }
            bh->b_private = NULL;
            jh->b_bh = NULL;	/* debug, really */
            clear_buffer_jbd(bh);
            __brelse(bh);
            journal_free_journal_head(jh);
        } else {
            BUFFER_TRACE(bh, "journal_head was locked");
        }
    }
}
开发者ID:Axure,项目名称:Ext3Fsd,代码行数:37,代码来源:replay.c

示例13: ocfs2_write_super_or_backup

/*
 * Write super block and backups doesn't need to collaborate with journal,
 * so we don't need to lock ip_io_mutex and inode doesn't need to bea passed
 * into this function.
 */
int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
				struct buffer_head *bh)
{
	int ret = 0;

	mlog_entry_void();

	BUG_ON(buffer_jbd(bh));
	ocfs2_check_super_or_backup(osb->sb, bh->b_blocknr);

	if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) {
		ret = -EROFS;
		goto out;
	}

	lock_buffer(bh);
	set_buffer_uptodate(bh);

	/* remove from dirty list before I/O. */
	clear_buffer_dirty(bh);

	get_bh(bh); /* for end_buffer_write_sync() */
	bh->b_end_io = end_buffer_write_sync;
	submit_bh(WRITE, bh);

	wait_on_buffer(bh);

	if (!buffer_uptodate(bh)) {
		ret = -EIO;
		put_bh(bh);
	}

out:
	mlog_exit(ret);
	return ret;
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:41,代码来源:buffer_head_io.c

示例14: journal_try_to_free_buffers

int journal_try_to_free_buffers(journal_t *journal,
				struct page *page, gfp_t gfp_mask)
{
	struct buffer_head *head;
	struct buffer_head *bh;
	int ret = 0;

	J_ASSERT(PageLocked(page));

	head = page_buffers(page);
	bh = head;
	do {
		struct journal_head *jh;

		/*
		 * We take our own ref against the journal_head here to avoid
		 * having to add tons of locking around each instance of
		 * journal_remove_journal_head() and journal_put_journal_head().
		 */
		jh = journal_grab_journal_head(bh);
		if (!jh)
			continue;

		jbd_lock_bh_state(bh);
		__journal_try_to_free_buffer(journal, bh);
		journal_put_journal_head(jh);
		jbd_unlock_bh_state(bh);
		if (buffer_jbd(bh))
			goto busy;
	} while ((bh = bh->b_this_page) != head);

	ret = try_to_free_buffers(page);

busy:
	return ret;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:36,代码来源:transaction.c

示例15: ocfs2_write_super_or_backup

/*
 * Write super block and backups doesn't need to collaborate with journal,
 * so we don't need to lock ip_io_mutex and ci doesn't need to bea passed
 * into this function.
 */
int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
				struct buffer_head *bh)
{
	int ret = 0;
	struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;

	BUG_ON(buffer_jbd(bh));
	ocfs2_check_super_or_backup(osb->sb, bh->b_blocknr);

	if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) {
		ret = -EROFS;
		mlog_errno(ret);
		goto out;
	}

	lock_buffer(bh);
	set_buffer_uptodate(bh);

	/* remove from dirty list before I/O. */
	clear_buffer_dirty(bh);

	get_bh(bh); /* for end_buffer_write_sync() */
	bh->b_end_io = end_buffer_write_sync;
	ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check);
	submit_bh(REQ_OP_WRITE, 0, bh);

	wait_on_buffer(bh);

	if (!buffer_uptodate(bh)) {
		ret = -EIO;
		mlog_errno(ret);
	}

out:
	return ret;
}
开发者ID:AK101111,项目名称:linux,代码行数:41,代码来源:buffer_head_io.c


注:本文中的buffer_jbd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。