diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-09-24 06:07:47 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-10-18 16:07:46 -0400 |
commit | 686865f76e35b28ba7aa6afa19209426f0da6201 (patch) | |
tree | 49f0ea4c6cb6ec4c71d1bce041ab21bbcd4920c8 /fs/xfs/linux-2.6 | |
parent | dcd79a1423f64ee0184629874805c3ac40f3a2c5 (diff) |
xfs: rename xfs_buf_get_nodaddr to be more appropriate
xfs_buf_get_nodaddr() is really used to allocate a buffer that is
uncached. While it is not directly assigned a disk address, the fact
that they are not cached is a more important distinction. With the
upcoming uncached buffer read primitive, we should be consistent
with this disctinction.
While there, make page allocation in xfs_buf_get_nodaddr() safe
against memory reclaim re-entrancy into the filesystem by allowing
a flags parameter to be passed.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 9 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_trace.h | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 286e36e21dae..eca945b0f88f 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -707,9 +707,10 @@ xfs_buf_associate_memory( | |||
707 | } | 707 | } |
708 | 708 | ||
709 | xfs_buf_t * | 709 | xfs_buf_t * |
710 | xfs_buf_get_noaddr( | 710 | xfs_buf_get_uncached( |
711 | struct xfs_buftarg *target, | ||
711 | size_t len, | 712 | size_t len, |
712 | xfs_buftarg_t *target) | 713 | int flags) |
713 | { | 714 | { |
714 | unsigned long page_count = PAGE_ALIGN(len) >> PAGE_SHIFT; | 715 | unsigned long page_count = PAGE_ALIGN(len) >> PAGE_SHIFT; |
715 | int error, i; | 716 | int error, i; |
@@ -725,7 +726,7 @@ xfs_buf_get_noaddr( | |||
725 | goto fail_free_buf; | 726 | goto fail_free_buf; |
726 | 727 | ||
727 | for (i = 0; i < page_count; i++) { | 728 | for (i = 0; i < page_count; i++) { |
728 | bp->b_pages[i] = alloc_page(GFP_KERNEL); | 729 | bp->b_pages[i] = alloc_page(xb_to_gfp(flags)); |
729 | if (!bp->b_pages[i]) | 730 | if (!bp->b_pages[i]) |
730 | goto fail_free_mem; | 731 | goto fail_free_mem; |
731 | } | 732 | } |
@@ -740,7 +741,7 @@ xfs_buf_get_noaddr( | |||
740 | 741 | ||
741 | xfs_buf_unlock(bp); | 742 | xfs_buf_unlock(bp); |
742 | 743 | ||
743 | trace_xfs_buf_get_noaddr(bp, _RET_IP_); | 744 | trace_xfs_buf_get_uncached(bp, _RET_IP_); |
744 | return bp; | 745 | return bp; |
745 | 746 | ||
746 | fail_free_mem: | 747 | fail_free_mem: |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 2a05614f0b92..fb30447091d8 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -213,7 +213,7 @@ extern xfs_buf_t *xfs_buf_read(xfs_buftarg_t *, xfs_off_t, size_t, | |||
213 | xfs_buf_flags_t); | 213 | xfs_buf_flags_t); |
214 | 214 | ||
215 | extern xfs_buf_t *xfs_buf_get_empty(size_t, xfs_buftarg_t *); | 215 | extern xfs_buf_t *xfs_buf_get_empty(size_t, xfs_buftarg_t *); |
216 | extern xfs_buf_t *xfs_buf_get_noaddr(size_t, xfs_buftarg_t *); | 216 | extern xfs_buf_t *xfs_buf_get_uncached(struct xfs_buftarg *, size_t, int); |
217 | extern int xfs_buf_associate_memory(xfs_buf_t *, void *, size_t); | 217 | extern int xfs_buf_associate_memory(xfs_buf_t *, void *, size_t); |
218 | extern void xfs_buf_hold(xfs_buf_t *); | 218 | extern void xfs_buf_hold(xfs_buf_t *); |
219 | extern void xfs_buf_readahead(xfs_buftarg_t *, xfs_off_t, size_t, | 219 | extern void xfs_buf_readahead(xfs_buftarg_t *, xfs_off_t, size_t, |
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h index be5dffd282a1..2a1d4fbd9ed8 100644 --- a/fs/xfs/linux-2.6/xfs_trace.h +++ b/fs/xfs/linux-2.6/xfs_trace.h | |||
@@ -331,7 +331,7 @@ DEFINE_BUF_EVENT(xfs_buf_iowait_done); | |||
331 | DEFINE_BUF_EVENT(xfs_buf_delwri_queue); | 331 | DEFINE_BUF_EVENT(xfs_buf_delwri_queue); |
332 | DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue); | 332 | DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue); |
333 | DEFINE_BUF_EVENT(xfs_buf_delwri_split); | 333 | DEFINE_BUF_EVENT(xfs_buf_delwri_split); |
334 | DEFINE_BUF_EVENT(xfs_buf_get_noaddr); | 334 | DEFINE_BUF_EVENT(xfs_buf_get_uncached); |
335 | DEFINE_BUF_EVENT(xfs_bdstrat_shut); | 335 | DEFINE_BUF_EVENT(xfs_bdstrat_shut); |
336 | DEFINE_BUF_EVENT(xfs_buf_item_relse); | 336 | DEFINE_BUF_EVENT(xfs_buf_item_relse); |
337 | DEFINE_BUF_EVENT(xfs_buf_item_iodone); | 337 | DEFINE_BUF_EVENT(xfs_buf_item_iodone); |