xfs_log.h (879f99ef2c4c05d9a7f0a67a05f1415663119825) xfs_log.h (110dc24ad2ae4e9b94b08632fe1eb2fcdff83045)
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 10 unchanged lines hidden (view full) ---

19#define __XFS_LOG_H__
20
21struct xfs_log_vec {
22 struct xfs_log_vec *lv_next; /* next lv in build list */
23 int lv_niovecs; /* number of iovecs in lv */
24 struct xfs_log_iovec *lv_iovecp; /* iovec array */
25 struct xfs_log_item *lv_item; /* owner */
26 char *lv_buf; /* formatted buffer */
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *

--- 10 unchanged lines hidden (view full) ---

19#define __XFS_LOG_H__
20
21struct xfs_log_vec {
22 struct xfs_log_vec *lv_next; /* next lv in build list */
23 int lv_niovecs; /* number of iovecs in lv */
24 struct xfs_log_iovec *lv_iovecp; /* iovec array */
25 struct xfs_log_item *lv_item; /* owner */
26 char *lv_buf; /* formatted buffer */
27 int lv_buf_len; /* size of formatted buffer */
27 int lv_bytes; /* accounted space in buffer */
28 int lv_buf_len; /* aligned size of buffer */
28 int lv_size; /* size of allocated lv */
29};
30
31#define XFS_LOG_VEC_ORDERED (-1)
32
33static inline void *
34xlog_prepare_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
35 uint type)

--- 11 unchanged lines hidden (view full) ---

47 vec->i_addr = lv->lv_buf + lv->lv_buf_len;
48
49 ASSERT(IS_ALIGNED((unsigned long)vec->i_addr, sizeof(uint64_t)));
50
51 *vecp = vec;
52 return vec->i_addr;
53}
54
29 int lv_size; /* size of allocated lv */
30};
31
32#define XFS_LOG_VEC_ORDERED (-1)
33
34static inline void *
35xlog_prepare_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
36 uint type)

--- 11 unchanged lines hidden (view full) ---

48 vec->i_addr = lv->lv_buf + lv->lv_buf_len;
49
50 ASSERT(IS_ALIGNED((unsigned long)vec->i_addr, sizeof(uint64_t)));
51
52 *vecp = vec;
53 return vec->i_addr;
54}
55
56/*
57 * We need to make sure the next buffer is naturally aligned for the biggest
58 * basic data type we put into it. We already accounted for this padding when
59 * sizing the buffer.
60 *
61 * However, this padding does not get written into the log, and hence we have to
62 * track the space used by the log vectors separately to prevent log space hangs
63 * due to inaccurate accounting (i.e. a leak) of the used log space through the
64 * CIL context ticket.
65 */
55static inline void
56xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec, int len)
57{
66static inline void
67xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec, int len)
68{
58 /*
59 * We need to make sure the next buffer is naturally aligned for the
60 * biggest basic data type we put into it. We already accounted for
61 * this when sizing the buffer.
62 */
63 lv->lv_buf_len += round_up(len, sizeof(uint64_t));
69 lv->lv_buf_len += round_up(len, sizeof(uint64_t));
70 lv->lv_bytes += len;
64 vec->i_len = len;
65}
66
67static inline void *
68xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
69 uint type, void *data, int len)
70{
71 void *buf;

--- 115 unchanged lines hidden ---
71 vec->i_len = len;
72}
73
74static inline void *
75xlog_copy_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
76 uint type, void *data, int len)
77{
78 void *buf;

--- 115 unchanged lines hidden ---