提交 3383ca57 编写于 作者: D Dave Chinner 提交者: Alex Elder

xfs: allow log ticket allocation to take allocation flags

Delayed logging currently requires ticket allocation to succeed, so
we need to be able to sleep on allocation. It also should not allow
memory allocation to recurse into the filesystem. hence we need to
pass allocation flags directing the type of allocation the caller
requires.
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 524ee36f
...@@ -88,11 +88,9 @@ STATIC void xlog_ungrant_log_space(xlog_t *log, ...@@ -88,11 +88,9 @@ STATIC void xlog_ungrant_log_space(xlog_t *log,
/* local ticket functions */ /* local ticket functions */
STATIC xlog_ticket_t *xlog_ticket_alloc(xlog_t *log, STATIC xlog_ticket_t *xlog_ticket_alloc(xlog_t *log, int unit_bytes, int count,
int unit_bytes, char clientid, uint flags,
int count, int alloc_flags);
char clientid,
uint flags);
#if defined(DEBUG) #if defined(DEBUG)
STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr); STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr);
...@@ -376,7 +374,8 @@ xfs_log_reserve( ...@@ -376,7 +374,8 @@ xfs_log_reserve(
} else { } else {
/* may sleep if need to allocate more tickets */ /* may sleep if need to allocate more tickets */
internal_ticket = xlog_ticket_alloc(log, unit_bytes, cnt, internal_ticket = xlog_ticket_alloc(log, unit_bytes, cnt,
client, flags); client, flags,
KM_SLEEP|KM_MAYFAIL);
if (!internal_ticket) if (!internal_ticket)
return XFS_ERROR(ENOMEM); return XFS_ERROR(ENOMEM);
internal_ticket->t_trans_type = t_type; internal_ticket->t_trans_type = t_type;
...@@ -3331,13 +3330,14 @@ xlog_ticket_alloc( ...@@ -3331,13 +3330,14 @@ xlog_ticket_alloc(
int unit_bytes, int unit_bytes,
int cnt, int cnt,
char client, char client,
uint xflags) uint xflags,
int alloc_flags)
{ {
struct xlog_ticket *tic; struct xlog_ticket *tic;
uint num_headers; uint num_headers;
int iclog_space; int iclog_space;
tic = kmem_zone_zalloc(xfs_log_ticket_zone, KM_SLEEP|KM_MAYFAIL); tic = kmem_zone_zalloc(xfs_log_ticket_zone, alloc_flags);
if (!tic) if (!tic)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部