aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index fa32655449c8..1a349f9a9685 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -53,6 +53,8 @@
53 * but never before the maximum hash table size has been reached. 53 * but never before the maximum hash table size has been reached.
54 */ 54 */
55 55
56#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
57
56#include <linux/slab.h> 58#include <linux/slab.h>
57#include <linux/spinlock.h> 59#include <linux/spinlock.h>
58#include <linux/buffer_head.h> 60#include <linux/buffer_head.h>
@@ -507,8 +509,8 @@ static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset,
507 goto error; 509 goto error;
508 return 0; 510 return 0;
509error: 511error:
510 printk(KERN_WARNING "gfs2_check_dirent: %s (%s)\n", msg, 512 pr_warn("%s: %s (%s)\n",
511 first ? "first in block" : "not first in block"); 513 __func__, msg, first ? "first in block" : "not first in block");
512 return -EIO; 514 return -EIO;
513} 515}
514 516
@@ -531,8 +533,7 @@ static int gfs2_dirent_offset(const void *buf)
531 } 533 }
532 return offset; 534 return offset;
533wrong_type: 535wrong_type:
534 printk(KERN_WARNING "gfs2_scan_dirent: wrong block type %u\n", 536 pr_warn("%s: wrong block type %u\n", __func__, be32_to_cpu(h->mh_type));
535 be32_to_cpu(h->mh_type));
536 return -1; 537 return -1;
537} 538}
538 539
@@ -728,7 +729,7 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
728 729
729 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, bhp); 730 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, bhp);
730 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) { 731 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
731 /* printk(KERN_INFO "block num=%llu\n", leaf_no); */ 732 /* pr_info("block num=%llu\n", leaf_no); */
732 error = -EIO; 733 error = -EIO;
733 } 734 }
734 735
@@ -1006,7 +1007,8 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
1006 len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth)); 1007 len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
1007 half_len = len >> 1; 1008 half_len = len >> 1;
1008 if (!half_len) { 1009 if (!half_len) {
1009 printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index); 1010 pr_warn("i_depth %u lf_depth %u index %u\n",
1011 dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
1010 gfs2_consist_inode(dip); 1012 gfs2_consist_inode(dip);
1011 error = -EIO; 1013 error = -EIO;
1012 goto fail_brelse; 1014 goto fail_brelse;
@@ -1684,6 +1686,14 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name)
1684 return 0; 1686 return 0;
1685} 1687}
1686 1688
1689static u16 gfs2_inode_ra_len(const struct gfs2_inode *ip)
1690{
1691 u64 where = ip->i_no_addr + 1;
1692 if (ip->i_eattr == where)
1693 return 1;
1694 return 0;
1695}
1696
1687/** 1697/**
1688 * gfs2_dir_add - Add new filename into directory 1698 * gfs2_dir_add - Add new filename into directory
1689 * @inode: The directory inode 1699 * @inode: The directory inode
@@ -1721,6 +1731,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
1721 dent = gfs2_init_dirent(inode, dent, name, bh); 1731 dent = gfs2_init_dirent(inode, dent, name, bh);
1722 gfs2_inum_out(nip, dent); 1732 gfs2_inum_out(nip, dent);
1723 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode)); 1733 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode));
1734 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip));
1724 tv = CURRENT_TIME; 1735 tv = CURRENT_TIME;
1725 if (ip->i_diskflags & GFS2_DIF_EXHASH) { 1736 if (ip->i_diskflags & GFS2_DIF_EXHASH) {
1726 leaf = (struct gfs2_leaf *)bh->b_data; 1737 leaf = (struct gfs2_leaf *)bh->b_data;