Skip to content

Commit 1236bbe

Browse files
Christoph Hellwigdchinner
authored andcommitted
xfs: remove xlog_verify_dest_ptr
Just check that the offset in xlog_write_vec is smaller than the iclog size and remove the expensive cycling through all iclogs. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent ad3e369 commit 1236bbe

2 files changed

Lines changed: 1 addition & 38 deletions

File tree

fs/xfs/xfs_log.c

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ xlog_sync(
6161
struct xlog_in_core *iclog);
6262
#if defined(DEBUG)
6363
STATIC void
64-
xlog_verify_dest_ptr(
65-
struct xlog *log,
66-
void *ptr);
67-
STATIC void
6864
xlog_verify_grant_tail(
6965
struct xlog *log);
7066
STATIC void
@@ -77,7 +73,6 @@ xlog_verify_tail_lsn(
7773
struct xlog *log,
7874
struct xlog_in_core *iclog);
7975
#else
80-
#define xlog_verify_dest_ptr(a,b)
8176
#define xlog_verify_grant_tail(a)
8277
#define xlog_verify_iclog(a,b,c)
8378
#define xlog_verify_tail_lsn(a,b)
@@ -1626,9 +1621,6 @@ xlog_alloc_log(
16261621
GFP_KERNEL | __GFP_RETRY_MAYFAIL);
16271622
if (!iclog->ic_data)
16281623
goto out_free_iclog;
1629-
#ifdef DEBUG
1630-
log->l_iclog_bak[i] = &iclog->ic_header;
1631-
#endif
16321624
head = &iclog->ic_header;
16331625
memset(head, 0, sizeof(xlog_rec_header_t));
16341626
head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
@@ -2220,6 +2212,7 @@ xlog_write_iovec(
22202212
uint32_t *record_cnt,
22212213
uint32_t *data_cnt)
22222214
{
2215+
ASSERT(*log_offset < iclog->ic_log->l_iclog_size);
22232216
ASSERT(*log_offset % sizeof(int32_t) == 0);
22242217
ASSERT(write_len % sizeof(int32_t) == 0);
22252218

@@ -2313,7 +2306,6 @@ xlog_write_partial(
23132306
int *contwr)
23142307
{
23152308
struct xlog_in_core *iclog = *iclogp;
2316-
struct xlog *log = iclog->ic_log;
23172309
struct xlog_op_header *ophdr;
23182310
int index = 0;
23192311
uint32_t rlen;
@@ -2352,7 +2344,6 @@ xlog_write_partial(
23522344
if (rlen != reg->i_len)
23532345
ophdr->oh_flags |= XLOG_CONTINUE_TRANS;
23542346

2355-
xlog_verify_dest_ptr(log, iclog->ic_datap + *log_offset);
23562347
xlog_write_iovec(iclog, log_offset, reg->i_addr,
23572348
rlen, len, record_cnt, data_cnt);
23582349

@@ -2420,7 +2411,6 @@ xlog_write_partial(
24202411
rlen = min_t(uint32_t, rlen, iclog->ic_size - *log_offset);
24212412
ophdr->oh_len = cpu_to_be32(rlen);
24222413

2423-
xlog_verify_dest_ptr(log, iclog->ic_datap + *log_offset);
24242414
xlog_write_iovec(iclog, log_offset,
24252415
reg->i_addr + reg_offset,
24262416
rlen, len, record_cnt, data_cnt);
@@ -3544,29 +3534,6 @@ xlog_ticket_alloc(
35443534
}
35453535

35463536
#if defined(DEBUG)
3547-
/*
3548-
* Make sure that the destination ptr is within the valid data region of
3549-
* one of the iclogs. This uses backup pointers stored in a different
3550-
* part of the log in case we trash the log structure.
3551-
*/
3552-
STATIC void
3553-
xlog_verify_dest_ptr(
3554-
struct xlog *log,
3555-
void *ptr)
3556-
{
3557-
int i;
3558-
int good_ptr = 0;
3559-
3560-
for (i = 0; i < log->l_iclog_bufs; i++) {
3561-
if (ptr >= log->l_iclog_bak[i] &&
3562-
ptr <= log->l_iclog_bak[i] + log->l_iclog_size)
3563-
good_ptr++;
3564-
}
3565-
3566-
if (!good_ptr)
3567-
xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
3568-
}
3569-
35703537
/*
35713538
* Check to make sure the grant write head didn't just over lap the tail. If
35723539
* the cycles are the same, we can't be overlapping. Otherwise, make sure that

fs/xfs/xfs_log_priv.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@ struct xlog {
420420

421421
struct xfs_kobj l_kobj;
422422

423-
/* The following field are used for debugging; need to hold icloglock */
424-
#ifdef DEBUG
425-
void *l_iclog_bak[XLOG_MAX_ICLOGS];
426-
#endif
427423
/* log recovery lsn tracking (for buffer submission */
428424
xfs_lsn_t l_recovery_lsn;
429425

0 commit comments

Comments
 (0)