mm: introduce page reference manipulation functions
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx4 / en_rx.c
index 41440b2b20a36108bac137b9ab2893beae398038..86bcfe510e4e5b930b94de462f5ff9a76d4183c4 100644 (file)
@@ -82,8 +82,7 @@ static int mlx4_alloc_pages(struct mlx4_en_priv *priv,
        /* Not doing get_page() for each frag is a big win
         * on asymetric workloads. Note we can not use atomic_set().
         */
-       atomic_add(page_alloc->page_size / frag_info->frag_stride - 1,
-                  &page->_count);
+       page_ref_add(page, page_alloc->page_size / frag_info->frag_stride - 1);
        return 0;
 }
 
@@ -127,7 +126,7 @@ out:
                        dma_unmap_page(priv->ddev, page_alloc[i].dma,
                                page_alloc[i].page_size, PCI_DMA_FROMDEVICE);
                        page = page_alloc[i].page;
-                       atomic_set(&page->_count, 1);
+                       set_page_count(page, 1);
                        put_page(page);
                }
        }
@@ -165,7 +164,7 @@ static int mlx4_en_init_allocator(struct mlx4_en_priv *priv,
 
                en_dbg(DRV, priv, "  frag %d allocator: - size:%d frags:%d\n",
                       i, ring->page_alloc[i].page_size,
-                      atomic_read(&ring->page_alloc[i].page->_count));
+                      page_ref_count(ring->page_alloc[i].page));
        }
        return 0;
 
@@ -177,7 +176,7 @@ out:
                dma_unmap_page(priv->ddev, page_alloc->dma,
                               page_alloc->page_size, PCI_DMA_FROMDEVICE);
                page = page_alloc->page;
-               atomic_set(&page->_count, 1);
+               set_page_count(page, 1);
                put_page(page);
                page_alloc->page = NULL;
        }