Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 686865f7 authored by Dave Chinner's avatar Dave Chinner Committed by Alex Elder
Browse files

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: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
parent dcd79a14
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -707,9 +707,10 @@ xfs_buf_associate_memory(
}
}


xfs_buf_t *
xfs_buf_t *
xfs_buf_get_noaddr(
xfs_buf_get_uncached(
	struct xfs_buftarg	*target,
	size_t			len,
	size_t			len,
	xfs_buftarg_t		*target)
	int			flags)
{
{
	unsigned long		page_count = PAGE_ALIGN(len) >> PAGE_SHIFT;
	unsigned long		page_count = PAGE_ALIGN(len) >> PAGE_SHIFT;
	int			error, i;
	int			error, i;
@@ -725,7 +726,7 @@ xfs_buf_get_noaddr(
		goto fail_free_buf;
		goto fail_free_buf;


	for (i = 0; i < page_count; i++) {
	for (i = 0; i < page_count; i++) {
		bp->b_pages[i] = alloc_page(GFP_KERNEL);
		bp->b_pages[i] = alloc_page(xb_to_gfp(flags));
		if (!bp->b_pages[i])
		if (!bp->b_pages[i])
			goto fail_free_mem;
			goto fail_free_mem;
	}
	}
@@ -740,7 +741,7 @@ xfs_buf_get_noaddr(


	xfs_buf_unlock(bp);
	xfs_buf_unlock(bp);


	trace_xfs_buf_get_noaddr(bp, _RET_IP_);
	trace_xfs_buf_get_uncached(bp, _RET_IP_);
	return bp;
	return bp;


 fail_free_mem:
 fail_free_mem:
+1 −1
Original line number Original line Diff line number Diff line
@@ -213,7 +213,7 @@ extern xfs_buf_t *xfs_buf_read(xfs_buftarg_t *, xfs_off_t, size_t,
				xfs_buf_flags_t);
				xfs_buf_flags_t);


extern xfs_buf_t *xfs_buf_get_empty(size_t, xfs_buftarg_t *);
extern xfs_buf_t *xfs_buf_get_empty(size_t, xfs_buftarg_t *);
extern xfs_buf_t *xfs_buf_get_noaddr(size_t, xfs_buftarg_t *);
extern xfs_buf_t *xfs_buf_get_uncached(struct xfs_buftarg *, size_t, int);
extern int xfs_buf_associate_memory(xfs_buf_t *, void *, size_t);
extern int xfs_buf_associate_memory(xfs_buf_t *, void *, size_t);
extern void xfs_buf_hold(xfs_buf_t *);
extern void xfs_buf_hold(xfs_buf_t *);
extern void xfs_buf_readahead(xfs_buftarg_t *, xfs_off_t, size_t,
extern void xfs_buf_readahead(xfs_buftarg_t *, xfs_off_t, size_t,
+1 −1
Original line number Original line Diff line number Diff line
@@ -331,7 +331,7 @@ DEFINE_BUF_EVENT(xfs_buf_iowait_done);
DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue);
DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue);
DEFINE_BUF_EVENT(xfs_buf_delwri_split);
DEFINE_BUF_EVENT(xfs_buf_delwri_split);
DEFINE_BUF_EVENT(xfs_buf_get_noaddr);
DEFINE_BUF_EVENT(xfs_buf_get_uncached);
DEFINE_BUF_EVENT(xfs_bdstrat_shut);
DEFINE_BUF_EVENT(xfs_bdstrat_shut);
DEFINE_BUF_EVENT(xfs_buf_item_relse);
DEFINE_BUF_EVENT(xfs_buf_item_relse);
DEFINE_BUF_EVENT(xfs_buf_item_iodone);
DEFINE_BUF_EVENT(xfs_buf_item_iodone);
+2 −1
Original line number Original line Diff line number Diff line
@@ -1131,7 +1131,8 @@ xlog_alloc_log(xfs_mount_t *mp,
		iclog->ic_prev = prev_iclog;
		iclog->ic_prev = prev_iclog;
		prev_iclog = iclog;
		prev_iclog = iclog;


		bp = xfs_buf_get_noaddr(log->l_iclog_size, mp->m_logdev_targp);
		bp = xfs_buf_get_uncached(mp->m_logdev_targp,
						log->l_iclog_size, 0);
		if (!bp)
		if (!bp)
			goto out_free_iclog;
			goto out_free_iclog;
		if (!XFS_BUF_CPSEMA(bp))
		if (!XFS_BUF_CPSEMA(bp))
+2 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,8 @@ xlog_get_bp(
		nbblks += log->l_sectBBsize;
		nbblks += log->l_sectBBsize;
	nbblks = round_up(nbblks, log->l_sectBBsize);
	nbblks = round_up(nbblks, log->l_sectBBsize);


	return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
	return xfs_buf_get_uncached(log->l_mp->m_logdev_targp,
					BBTOB(nbblks), 0);
}
}


STATIC void
STATIC void
Loading