aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2018-10-03 09:47:36 -0400
committerBob Peterson <rpeterso@redhat.com>2018-10-05 12:16:54 -0400
commite54c78a27fcdef406af799f360a93e6754adeefe (patch)
tree11cce8cb95ecd48c015f7f8d311154decdb90f9e /fs/gfs2/dir.c
parentb524abcc01483b2ac093cc6a8a2a7375558d2b64 (diff)
gfs2: Use fs_* functions instead of pr_* function where we can
Before this patch, various errors and messages were reported using the pr_* functions: pr_err, pr_warn, pr_info, etc., but that does not tell you which gfs2 mount had the problem, which is often vital to debugging. This patch changes the calls from pr_* to fs_* in most of the messages so that the file system id is printed along with the message. Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index e37002560c11..2e28fc947f7f 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -506,7 +506,8 @@ static int gfs2_dirent_gather(const struct gfs2_dirent *dent,
506 * For now the most important thing is to check that the various sizes 506 * For now the most important thing is to check that the various sizes
507 * are correct. 507 * are correct.
508 */ 508 */
509static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset, 509static int gfs2_check_dirent(struct gfs2_sbd *sdp,
510 struct gfs2_dirent *dent, unsigned int offset,
510 unsigned int size, unsigned int len, int first) 511 unsigned int size, unsigned int len, int first)
511{ 512{
512 const char *msg = "gfs2_dirent too small"; 513 const char *msg = "gfs2_dirent too small";
@@ -528,12 +529,12 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
528 goto error; 529 goto error;
529 return 0; 530 return 0;
530error: 531error:
531 pr_warn("%s: %s (%s)\n", 532 fs_warn(sdp, "%s: %s (%s)\n",
532 __func__, msg, first ? "first in block" : "not first in block"); 533 __func__, msg, first ? "first in block" : "not first in block");
533 return -EIO; 534 return -EIO;
534} 535}
535 536
536static int gfs2_dirent_offset(const void *buf) 537static int gfs2_dirent_offset(struct gfs2_sbd *sdp, const void *buf)
537{ 538{
538 const struct gfs2_meta_header *h = buf; 539 const struct gfs2_meta_header *h = buf;
539 int offset; 540 int offset;
@@ -552,7 +553,8 @@ static int gfs2_dirent_offset(const void *buf)
552 } 553 }
553 return offset; 554 return offset;
554wrong_type: 555wrong_type:
555 pr_warn("%s: wrong block type %u\n", __func__, be32_to_cpu(h->mh_type)); 556 fs_warn(sdp, "%s: wrong block type %u\n", __func__,
557 be32_to_cpu(h->mh_type));
556 return -1; 558 return -1;
557} 559}
558 560
@@ -566,7 +568,7 @@ static struct gfs2_dirent *gfs2_dirent_scan(struct inode *inode, void *buf,
566 unsigned size; 568 unsigned size;
567 int ret = 0; 569 int ret = 0;
568 570
569 ret = gfs2_dirent_offset(buf); 571 ret = gfs2_dirent_offset(GFS2_SB(inode), buf);
570 if (ret < 0) 572 if (ret < 0)
571 goto consist_inode; 573 goto consist_inode;
572 574
@@ -574,7 +576,7 @@ static struct gfs2_dirent *gfs2_dirent_scan(struct inode *inode, void *buf,
574 prev = NULL; 576 prev = NULL;
575 dent = buf + offset; 577 dent = buf + offset;
576 size = be16_to_cpu(dent->de_rec_len); 578 size = be16_to_cpu(dent->de_rec_len);
577 if (gfs2_check_dirent(dent, offset, size, len, 1)) 579 if (gfs2_check_dirent(GFS2_SB(inode), dent, offset, size, len, 1))
578 goto consist_inode; 580 goto consist_inode;
579 do { 581 do {
580 ret = scan(dent, name, opaque); 582 ret = scan(dent, name, opaque);
@@ -586,7 +588,8 @@ static struct gfs2_dirent *gfs2_dirent_scan(struct inode *inode, void *buf,
586 prev = dent; 588 prev = dent;
587 dent = buf + offset; 589 dent = buf + offset;
588 size = be16_to_cpu(dent->de_rec_len); 590 size = be16_to_cpu(dent->de_rec_len);
589 if (gfs2_check_dirent(dent, offset, size, len, 0)) 591 if (gfs2_check_dirent(GFS2_SB(inode), dent, offset, size,
592 len, 0))
590 goto consist_inode; 593 goto consist_inode;
591 } while(1); 594 } while(1);
592 595
@@ -1043,7 +1046,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
1043 len = BIT(dip->i_depth - be16_to_cpu(oleaf->lf_depth)); 1046 len = BIT(dip->i_depth - be16_to_cpu(oleaf->lf_depth));
1044 half_len = len >> 1; 1047 half_len = len >> 1;
1045 if (!half_len) { 1048 if (!half_len) {
1046 pr_warn("i_depth %u lf_depth %u index %u\n", 1049 fs_warn(GFS2_SB(inode), "i_depth %u lf_depth %u index %u\n",
1047 dip->i_depth, be16_to_cpu(oleaf->lf_depth), index); 1050 dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
1048 gfs2_consist_inode(dip); 1051 gfs2_consist_inode(dip);
1049 error = -EIO; 1052 error = -EIO;
@@ -1351,7 +1354,7 @@ static int gfs2_set_cookies(struct gfs2_sbd *sdp, struct buffer_head *bh,
1351 if (!sdp->sd_args.ar_loccookie) 1354 if (!sdp->sd_args.ar_loccookie)
1352 continue; 1355 continue;
1353 offset = (char *)(darr[i]) - 1356 offset = (char *)(darr[i]) -
1354 (bh->b_data + gfs2_dirent_offset(bh->b_data)); 1357 (bh->b_data + gfs2_dirent_offset(sdp, bh->b_data));
1355 offset /= GFS2_MIN_DIRENT_SIZE; 1358 offset /= GFS2_MIN_DIRENT_SIZE;
1356 offset += leaf_nr * sdp->sd_max_dents_per_leaf; 1359 offset += leaf_nr * sdp->sd_max_dents_per_leaf;
1357 if (offset >= GFS2_USE_HASH_FLAG || 1360 if (offset >= GFS2_USE_HASH_FLAG ||