Exemplo n.º 1
0
/**
 * fscache_enqueue_operation - Enqueue an operation for processing
 * @op: The operation to enqueue
 *
 * Enqueue an operation for processing by the FS-Cache thread pool.
 *
 * This will get its own ref on the object.
 */
void fscache_enqueue_operation(struct fscache_operation *op)
{
	_enter("{OBJ%x OP%x,%u}",
	       op->object->debug_id, op->debug_id, atomic_read(&op->usage));

	ASSERT(list_empty(&op->pend_link));
	ASSERT(op->processor != NULL);
	ASSERTCMP(op->object->state, >=, FSCACHE_OBJECT_AVAILABLE);
	ASSERTCMP(atomic_read(&op->usage), >, 0);

	fscache_stat(&fscache_n_op_enqueue);
	switch (op->flags & FSCACHE_OP_TYPE) {
	case FSCACHE_OP_ASYNC:
		_debug("queue async");
		atomic_inc(&op->usage);
		if (!queue_work(fscache_op_wq, &op->work))
			fscache_put_operation(op);
		break;
	case FSCACHE_OP_MYTHREAD:
		_debug("queue for caller's attention");
		break;
	default:
//		printk(KERN_ERR "FS-Cache: Unexpected op type %lx",
;
		BUG();
		break;
	}
}
Exemplo n.º 2
0
/**
 * fscache_enqueue_operation - Enqueue an operation for processing
 * @op: The operation to enqueue
 *
 * Enqueue an operation for processing by the FS-Cache thread pool.
 *
 * This will get its own ref on the object.
 */
void fscache_enqueue_operation(struct fscache_operation *op)
{
    _enter("{OBJ%x OP%x,%u}",
           op->object->debug_id, op->debug_id, atomic_read(&op->usage));

    fscache_set_op_state(op, "EnQ");

    ASSERT(list_empty(&op->pend_link));
    ASSERT(op->processor != NULL);
    ASSERT(fscache_object_is_available(op->object));
    ASSERTCMP(atomic_read(&op->usage), >, 0);
    ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS);

    fscache_stat(&fscache_n_op_enqueue);
    switch (op->flags & FSCACHE_OP_TYPE) {
    case FSCACHE_OP_FAST:
        _debug("queue fast");
        atomic_inc(&op->usage);
        if (!schedule_work(&op->fast_work))
            fscache_put_operation(op);
        break;
    case FSCACHE_OP_SLOW:
        _debug("queue slow");
        slow_work_enqueue(&op->slow_work);
        break;
    case FSCACHE_OP_MYTHREAD:
        _debug("queue for caller's attention");
        break;
    default:
        printk(KERN_ERR "FS-Cache: Unexpected op type %lx",
               op->flags);
        BUG();
        break;
    }
}
/**
 * fscache_enqueue_operation - Enqueue an operation for processing
 * @op: The operation to enqueue
 *
 * Enqueue an operation for processing by the FS-Cache thread pool.
 *
 * This will get its own ref on the object.
 */
void fscache_enqueue_operation(struct fscache_operation *op)
{
	_enter("{OBJ%x OP%x,%u}",
	       op->object->debug_id, op->debug_id, atomic_read(&op->usage));

	ASSERT(list_empty(&op->pend_link));
	ASSERT(op->processor != NULL);
	ASSERT(fscache_object_is_available(op->object));
	ASSERTCMP(atomic_read(&op->usage), >, 0);
	ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS);

	fscache_stat(&fscache_n_op_enqueue);
	switch (op->flags & FSCACHE_OP_TYPE) {
	case FSCACHE_OP_ASYNC:
		_debug("queue async");
		atomic_inc(&op->usage);
		if (!queue_work(fscache_op_wq, &op->work))
			fscache_put_operation(op);
		break;
	case FSCACHE_OP_MYTHREAD:
		_debug("queue for caller's attention");
		break;
	default:
		pr_err("Unexpected op type %lx", op->flags);
		BUG();
		break;
	}
}