Re: [PATCH Version 7 2/3] NFSv4.1 prepare for dynamic session slots

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/12/12 12:52, andros@xxxxxxxxxx wrote:

> From: Andy Adamson <andros@xxxxxxxxxx>
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 18b095a..11f4e96 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -350,6 +350,127 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp
>  #if defined(CONFIG_NFS_V4_1)
>  
>  /*
> + * Slot table hlist functions
> + */
> +
> +static inline u32 slot_tbl_hash(u8 slotid)
> +{
> +	return (u32)slotid % SLOT_HASH_TBL_SZ;
> +}
> +
> +/*
> + * Allocate the slot the requested slotid.
> + * Called outside of the slot_tbl_lock. If the slot is already allocated,
> + * return success.
> + */
> +static int
> +nfs4_alloc_insert_slot(struct nfs4_slot_table *tbl, int ivalue, int slotid,
> +		    gfp_t gfp_flags)
> +{
> +	struct nfs4_slot *new;
> +	u32 hash = slot_tbl_hash(slotid);
> +
> +	dprintk("--> %s slotid=%u\n", __func__, slotid);
> +
> +	new = kzalloc(sizeof(struct nfs4_slot), gfp_flags);
> +	if (!new)
> +		return -ENOMEM;
> +	INIT_HLIST_NODE(&new->node);
> +	new->slot_id = slotid;
> +	new->seq_nr = ivalue;
> +	spin_lock(&tbl->slot_tbl_lock);
> +	hlist_add_head(&new->node, &tbl->slots[hash]);
> +	tbl->max_slots++;
> +	spin_unlock(&tbl->slot_tbl_lock);
> +	return 0;
> +}
> +
> +/*
> + * Allocate the negotiated number of slots and place them in the hlist.
> + * Called at session initialization, or session reset (with session
> + * drained).
> + *
> + * @start - the slotid where allocation starts.
> + * @num   - the number of slots to allocate.
> + *
> + */
> +static int nfs4_alloc_slots(struct nfs4_slot_table *tbl, int ivalue,
> +			    int start, int num, gfp_t gfp_flags)
> +{
> +int i, ret = 0;


Not a big deal, but I think a tab got lost here.

- Bryan

> +
> +	for (i = start; i < start + num; i++) {
> +		ret = nfs4_alloc_insert_slot(tbl, ivalue, i, gfp_flags);
> +		if (ret)
> +			break;
> +	}
> +	return ret;
> +}


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux