[Devel] Re: [PATCH 2/2] Change net c/r to use exported page I/O functions

Serge E. Hallyn serue at us.ibm.com
Tue Nov 17 20:17:07 PST 2009


Quoting Dan Smith (danms at us.ibm.com):
> +static int __sock_write_skb_frag(struct ckpt_ctx *ctx,
> +				 skb_frag_t *frag)
> +{
> +	struct ckpt_hdr_socket_buffer_frag *h;
> +	int ret;
> +
> +	h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_SOCKET_FRAG);
> +	if (!h)
> +		return -ENOMEM;
> +
> +	h->size = frag->size;
> +	h->offset = frag->page_offset;
> +
> +	ret = ckpt_write_obj(ctx, (struct ckpt_hdr *)h);
> +	ckpt_hdr_put(ctx, h);
> +	if (ret < 0)
> +		goto out;
> +
> +	ret = checkpoint_dump_page(ctx, frag->page);
> +	ckpt_debug("writing frag page: %i\n", ret);
> +	if (ret < 0)
> +		goto out;
> +
> + out:
> +	ckpt_hdr_put(ctx, h);

I assume you meant to get rid of this second ckpt_hdr_put()?

> +
> +	return ret;
> +}
> +
>  static int __sock_write_skb(struct ckpt_ctx *ctx,
>  			    struct sk_buff *skb,
>  			    int dst_objref)
> @@ -316,16 +348,12 @@ static int __sock_write_skb(struct ckpt_ctx *ctx,
> 
>  	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
>  		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
> -		u8 *vaddr = kmap(frag->page);
> -
> +		ret = __sock_write_skb_frag(ctx, frag);
>  		ckpt_debug("writing buffer fragment %i/%i (%i)\n",
> -			   i + 1, h->nr_frags, frag->size);
> -		ret = ckpt_write_obj_type(ctx, vaddr + frag->page_offset,
> -					  frag->size, CKPT_HDR_BUFFER);
> -		kunmap(frag->page);
> -		h->frg_len -= frag->size;
> +			   i + 1, h->nr_frags, ret);
>  		if (ret < 0)
>  			goto out;
> +		h->frg_len -= frag->size;
>  	}
> 
>  	WARN_ON(h->frg_len != 0);
> -- 
> 1.6.2.5
> 
> _______________________________________________
> Containers mailing list
> Containers at lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list