Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198359
b: refs/heads/master
c: 71e330b
h: refs/heads/master
i:
  198357: bf1a6f9
  198355: 89e6d2a
  198351: 5224b30
v: v3
  • Loading branch information
Dave Chinner authored and Alex Elder committed May 24, 2010
1 parent 1861600 commit c03ed39
Show file tree
Hide file tree
Showing 12 changed files with 913 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a9a745daadab26f13884ff26a50fa38247c11ce9
refs/heads/master: 71e330b593905e40d6c5afa824d38ee02d70ce5f
1 change: 1 addition & 0 deletions trunk/fs/xfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ xfs-y += xfs_alloc.o \
xfs_itable.o \
xfs_dfrag.o \
xfs_log.o \
xfs_log_cil.o \
xfs_log_recover.o \
xfs_mount.o \
xfs_mru_cache.o \
Expand Down
10 changes: 10 additions & 0 deletions trunk/fs/xfs/linux-2.6/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ mempool_t *xfs_ioend_pool;
#define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */
#define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */
#define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */
#define MNTOPT_DELAYLOG "delaylog" /* Delayed loging enabled */
#define MNTOPT_NODELAYLOG "nodelaylog" /* Delayed loging disabled */

/*
* Table driven mount option parser.
Expand Down Expand Up @@ -374,6 +376,13 @@ xfs_parseargs(
mp->m_flags |= XFS_MOUNT_DMAPI;
} else if (!strcmp(this_char, MNTOPT_DMI)) {
mp->m_flags |= XFS_MOUNT_DMAPI;
} else if (!strcmp(this_char, MNTOPT_DELAYLOG)) {
mp->m_flags |= XFS_MOUNT_DELAYLOG;
cmn_err(CE_WARN,
"Enabling EXPERIMENTAL delayed logging feature "
"- use at your own risk.\n");
} else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) {
mp->m_flags &= ~XFS_MOUNT_DELAYLOG;
} else if (!strcmp(this_char, "ihashsize")) {
cmn_err(CE_WARN,
"XFS: ihashsize no longer used, option is deprecated.");
Expand Down Expand Up @@ -535,6 +544,7 @@ xfs_showargs(
{ XFS_MOUNT_FILESTREAMS, "," MNTOPT_FILESTREAM },
{ XFS_MOUNT_DMAPI, "," MNTOPT_DMAPI },
{ XFS_MOUNT_GRPID, "," MNTOPT_GRPID },
{ XFS_MOUNT_DELAYLOG, "," MNTOPT_DELAYLOG },
{ 0, NULL }
};
static struct proc_xfs_info xfs_info_unset[] = {
Expand Down
64 changes: 49 additions & 15 deletions trunk/fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp,
STATIC int xlog_space_left(xlog_t *log, int cycle, int bytes);
STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
STATIC void xlog_dealloc_log(xlog_t *log);
STATIC int xlog_write(struct log *log, struct xfs_log_vec *log_vector,
struct xlog_ticket *tic, xfs_lsn_t *start_lsn,
xlog_in_core_t **commit_iclog, uint flags);

/* local state machine functions */
STATIC void xlog_state_done_syncing(xlog_in_core_t *iclog, int);
Expand Down Expand Up @@ -86,12 +83,6 @@ STATIC int xlog_regrant_write_log_space(xlog_t *log,
STATIC void xlog_ungrant_log_space(xlog_t *log,
xlog_ticket_t *ticket);


/* local ticket functions */
STATIC xlog_ticket_t *xlog_ticket_alloc(xlog_t *log, int unit_bytes, int count,
char clientid, uint flags,
int alloc_flags);

#if defined(DEBUG)
STATIC void xlog_verify_dest_ptr(xlog_t *log, char *ptr);
STATIC void xlog_verify_grant_head(xlog_t *log, int equals);
Expand Down Expand Up @@ -460,6 +451,13 @@ xfs_log_mount(
/* Normal transactions can now occur */
mp->m_log->l_flags &= ~XLOG_ACTIVE_RECOVERY;

/*
* Now the log has been fully initialised and we know were our
* space grant counters are, we can initialise the permanent ticket
* needed for delayed logging to work.
*/
xlog_cil_init_post_recovery(mp->m_log);

return 0;

out_destroy_ail:
Expand Down Expand Up @@ -666,6 +664,10 @@ xfs_log_item_init(
item->li_ailp = mp->m_ail;
item->li_type = type;
item->li_ops = ops;
item->li_lv = NULL;

INIT_LIST_HEAD(&item->li_ail);
INIT_LIST_HEAD(&item->li_cil);
}

/*
Expand Down Expand Up @@ -1176,6 +1178,9 @@ xlog_alloc_log(xfs_mount_t *mp,
*iclogp = log->l_iclog; /* complete ring */
log->l_iclog->ic_prev = prev_iclog; /* re-write 1st prev ptr */

error = xlog_cil_init(log);
if (error)
goto out_free_iclog;
return log;

out_free_iclog:
Expand Down Expand Up @@ -1502,6 +1507,8 @@ xlog_dealloc_log(xlog_t *log)
xlog_in_core_t *iclog, *next_iclog;
int i;

xlog_cil_destroy(log);

iclog = log->l_iclog;
for (i=0; i<log->l_iclog_bufs; i++) {
sv_destroy(&iclog->ic_force_wait);
Expand Down Expand Up @@ -1544,8 +1551,10 @@ xlog_state_finish_copy(xlog_t *log,
* print out info relating to regions written which consume
* the reservation
*/
STATIC void
xlog_print_tic_res(xfs_mount_t *mp, xlog_ticket_t *ticket)
void
xlog_print_tic_res(
struct xfs_mount *mp,
struct xlog_ticket *ticket)
{
uint i;
uint ophdr_spc = ticket->t_res_num_ophdrs * (uint)sizeof(xlog_op_header_t);
Expand Down Expand Up @@ -1877,7 +1886,7 @@ xlog_write_copy_finish(
* we don't update ic_offset until the end when we know exactly how many
* bytes have been written out.
*/
STATIC int
int
xlog_write(
struct log *log,
struct xfs_log_vec *log_vector,
Expand All @@ -1901,9 +1910,26 @@ xlog_write(
*start_lsn = 0;

len = xlog_write_calc_vec_length(ticket, log_vector);
if (ticket->t_curr_res < len)
if (log->l_cilp) {
/*
* Region headers and bytes are already accounted for.
* We only need to take into account start records and
* split regions in this function.
*/
if (ticket->t_flags & XLOG_TIC_INITED)
ticket->t_curr_res -= sizeof(xlog_op_header_t);

/*
* Commit record headers need to be accounted for. These
* come in as separate writes so are easy to detect.
*/
if (flags & (XLOG_COMMIT_TRANS | XLOG_UNMOUNT_TRANS))
ticket->t_curr_res -= sizeof(xlog_op_header_t);
} else
ticket->t_curr_res -= len;

if (ticket->t_curr_res < 0)
xlog_print_tic_res(log->l_mp, ticket);
ticket->t_curr_res -= len;

index = 0;
lv = log_vector;
Expand Down Expand Up @@ -2999,6 +3025,8 @@ _xfs_log_force(

XFS_STATS_INC(xs_log_force);

xlog_cil_push(log, 1);

spin_lock(&log->l_icloglock);

iclog = log->l_iclog;
Expand Down Expand Up @@ -3148,6 +3176,12 @@ _xfs_log_force_lsn(

XFS_STATS_INC(xs_log_force);

if (log->l_cilp) {
lsn = xlog_cil_push_lsn(log, lsn);
if (lsn == NULLCOMMITLSN)
return 0;
}

try_again:
spin_lock(&log->l_icloglock);
iclog = log->l_iclog;
Expand Down Expand Up @@ -3322,7 +3356,7 @@ xfs_log_get_trans_ident(
/*
* Allocate and initialise a new log ticket.
*/
STATIC xlog_ticket_t *
xlog_ticket_t *
xlog_ticket_alloc(
struct log *log,
int unit_bytes,
Expand Down
9 changes: 8 additions & 1 deletion trunk/fs/xfs/xfs_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ struct xfs_log_vec {
struct xfs_log_vec *lv_next; /* next lv in build list */
int lv_niovecs; /* number of iovecs in lv */
struct xfs_log_iovec *lv_iovecp; /* iovec array */
struct xfs_log_item *lv_item; /* owner */
char *lv_buf; /* formatted buffer */
int lv_buf_len; /* size of formatted buffer */
};

/*
Expand Down Expand Up @@ -187,11 +190,15 @@ int xfs_log_need_covered(struct xfs_mount *mp);

void xlog_iodone(struct xfs_buf *);

struct xlog_ticket * xfs_log_ticket_get(struct xlog_ticket *ticket);
struct xlog_ticket *xfs_log_ticket_get(struct xlog_ticket *ticket);
void xfs_log_ticket_put(struct xlog_ticket *ticket);

xlog_tid_t xfs_log_get_trans_ident(struct xfs_trans *tp);

int xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp,
struct xfs_log_vec *log_vector,
xfs_lsn_t *commit_lsn, int flags);

#endif


Expand Down
Loading

0 comments on commit c03ed39

Please sign in to comment.