Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for...
[safe/jmp/linux-2.6] / include / linux / i2o.h
index 4c18b77..c115e9e 100644 (file)
 
 /* defines for max_sectors and max_phys_segments */
 #define I2O_MAX_SECTORS                        1024
-#define I2O_MAX_SECTORS_LIMITED                256
+#define I2O_MAX_SECTORS_LIMITED                128
 #define I2O_MAX_PHYS_SEGMENTS          MAX_PHYS_SEGMENTS
 
 /*
@@ -950,9 +950,7 @@ static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
        if (!pool->slab)
                goto free_name;
 
-       pool->mempool =
-           mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
-                          pool->slab);
+       pool->mempool = mempool_create_slab_pool(min_nr, pool->slab);
        if (!pool->mempool)
                goto free_slab;
 
@@ -1115,9 +1113,14 @@ static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
                return ERR_PTR(-ENOMEM);
 
        mmsg->mfa = readl(c->in_port);
-       if (mmsg->mfa == I2O_QUEUE_EMPTY) {
+       if (unlikely(mmsg->mfa >= c->in_queue.len)) {
+               u32 mfa = mmsg->mfa;
+
                mempool_free(mmsg, c->in_msg.mempool);
-               return ERR_PTR(-EBUSY);
+
+               if (mfa == I2O_QUEUE_EMPTY)
+                       return ERR_PTR(-EBUSY);
+               return ERR_PTR(-EFAULT);
        }
 
        return &mmsg->msg;