From: Bill O'Donnell <billodo@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH v2] xfs_db: improve argument naming in set_cur and set_iocur_type
Date: Wed, 28 Jun 2017 14:25:56 -0500 [thread overview]
Message-ID: <20170628192556.9464-1-billodo@redhat.com> (raw)
In-Reply-To: <20170628150913.15934-1-billodo@redhat.com>
In set_cur and set_iocur_type, the current naming for arguments
type, block number, and length are t, d, and c, respectively.
Replace these with more intuitive and descriptive names:
type, blknum, and len. Fix type of blknum (xfs_daddr_t) to be
consistent with that of libxfs_readbuf where it's used.
Additionally remove extra blank line in io.c.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
v2: Fix type of blknum (xfs_daddr_t) to be consistent with that of
libxfs_readbuf. Rebase this patch on recently submitted
xfs_db patch touching the same file.
(https://www.spinics.net/lists/linux-xfs/msg07909.html)
db/io.c | 38 +++++++++++++++++++-------------------
db/io.h | 6 +++---
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/db/io.c b/db/io.c
index b97b710d..9a893932 100644
--- a/db/io.c
+++ b/db/io.c
@@ -536,9 +536,9 @@ write_cur(void)
void
set_cur(
- const typ_t *t,
- __int64_t d,
- int c,
+ const typ_t *type,
+ xfs_daddr_t blknum,
+ int len,
int ring_flag,
bbmap_t *bbmap)
{
@@ -546,14 +546,13 @@ set_cur(
xfs_ino_t dirino;
xfs_ino_t ino;
__uint16_t mode;
- const struct xfs_buf_ops *ops = t ? t->bops : NULL;
+ const struct xfs_buf_ops *ops = type ? type->bops : NULL;
if (iocur_sp < 0) {
dbprintf(_("set_cur no stack element to set\n"));
return;
}
-
ino = iocur_top->ino;
dirino = iocur_top->dirino;
mode = iocur_top->mode;
@@ -563,7 +562,7 @@ set_cur(
if (bbmap) {
#ifdef DEBUG_BBMAP
int i;
- printf(_("xfs_db got a bbmap for %lld\n"), (long long)d);
+ printf(_("xfs_db got a bbmap for %lld\n"), (long long)blknum);
printf(_("\tblock map"));
for (i = 0; i < bbmap->nmaps; i++)
printf(" %lld:%d", (long long)bbmap->b[i].bm_bn,
@@ -577,7 +576,7 @@ set_cur(
bp = libxfs_readbuf_map(mp->m_ddev_targp, bbmap->b,
bbmap->nmaps, 0, ops);
} else {
- bp = libxfs_readbuf(mp->m_ddev_targp, d, c, 0, ops);
+ bp = libxfs_readbuf(mp->m_ddev_targp, blknum, len, 0, ops);
iocur_top->bbmap = NULL;
}
@@ -593,13 +592,13 @@ set_cur(
if (!ops)
bp->b_flags |= LIBXFS_B_UNCHECKED;
- iocur_top->bb = d;
- iocur_top->blen = c;
+ iocur_top->bb = blknum;
+ iocur_top->blen = len;
iocur_top->boff = 0;
iocur_top->data = iocur_top->buf;
- iocur_top->len = BBTOB(c);
- iocur_top->off = d << BBSHIFT;
- iocur_top->typ = cur_typ = t;
+ iocur_top->len = BBTOB(len);
+ iocur_top->off = blknum << BBSHIFT;
+ iocur_top->typ = cur_typ = type;
iocur_top->ino = ino;
iocur_top->dirino = dirino;
iocur_top->mode = mode;
@@ -613,22 +612,23 @@ set_cur(
void
set_iocur_type(
- const typ_t *t)
+ const typ_t *type)
{
struct xfs_buf *bp = iocur_top->bp;
int bb_count;
/* adjust cursor for types that contain fields */
- if (t->fields) {
- bb_count = BTOBB(byteize(fsize(t->fields, iocur_top->data, 0, 0)));
- set_cur(t, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
+ if (type->fields) {
+ bb_count = BTOBB(byteize(fsize(type->fields,
+ iocur_top->data, 0, 0)));
+ set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
}
- iocur_top->typ = t;
+ iocur_top->typ = type;
/* verify the buffer if the type has one. */
if (!bp)
return;
- if (!t->bops) {
+ if (!type->bops) {
bp->b_ops = NULL;
bp->b_flags |= LIBXFS_B_UNCHECKED;
return;
@@ -636,7 +636,7 @@ set_iocur_type(
if (!(bp->b_flags & LIBXFS_B_UPTODATE))
return;
bp->b_error = 0;
- bp->b_ops = t->bops;
+ bp->b_ops = type->bops;
bp->b_ops->verify_read(bp);
bp->b_flags &= ~LIBXFS_B_UNCHECKED;
}
diff --git a/db/io.h b/db/io.h
index b415b82d..99730048 100644
--- a/db/io.h
+++ b/db/io.h
@@ -59,10 +59,10 @@ extern void print_iocur(char *tag, iocur_t *ioc);
extern void push_cur(void);
extern int read_buf(__int64_t daddr, int count, void *bufp);
extern void write_cur(void);
-extern void set_cur(const struct typ *t, __int64_t d, int c, int ring_add,
- bbmap_t *bbmap);
+extern void set_cur(const struct typ *type, xfs_daddr_t blknum,
+ int len, int ring_add, bbmap_t *bbmap);
extern void ring_add(void);
-extern void set_iocur_type(const struct typ *t);
+extern void set_iocur_type(const struct typ *type);
extern void xfs_dummy_verify(struct xfs_buf *bp);
extern void xfs_verify_recalc_inode_crc(struct xfs_buf *bp);
extern void xfs_verify_recalc_dquot_crc(struct xfs_buf *bp);
--
2.13.0
prev parent reply other threads:[~2017-06-28 19:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 15:09 [PATCH] xfs_db: improve argument naming in set_cur and set_iocur_type Bill O'Donnell
2017-06-28 16:40 ` Christoph Hellwig
2017-06-28 16:48 ` Darrick J. Wong
2017-06-28 18:04 ` Bill O'Donnell
2017-06-28 18:38 ` Eric Sandeen
2017-06-28 18:42 ` Bill O'Donnell
2017-06-28 19:25 ` Bill O'Donnell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170628192556.9464-1-billodo@redhat.com \
--to=billodo@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).