957 return 1;
958 }
959
960 gfs2_trans_add_bh(dip->i_gl, obh, 1);
961
962 nleaf = new_leaf(inode, &nbh, be16_to_cpu(oleaf->lf_depth) + 1);
963 if (!nleaf) {
964 brelse(obh);
965 return -ENOSPC;
966 }
967 bn = nbh->b_blocknr;
968
969
970 len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth));
971 half_len = len >> 1;
972 if (!half_len) {
973 printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
974 gfs2_consist_inode(dip);
975 error = -EIO;
976 goto fail_brelse;
977 }
978
979 start = (index & ~(len - 1));
980
981
982
983
984 lp = kmalloc(half_len * sizeof(__be64), GFP_NOFS | __GFP_NOFAIL);
985
986 for (x = 0; x < half_len; x++)
987 lp[x] = cpu_to_be64(bn);
988
989 error = gfs2_dir_write_data(dip, (char *)lp, start * sizeof(u64),
990 half_len * sizeof(u64));
991 if (error != half_len * sizeof(u64)) {
992 if (error >= 0)
993 error = -EIO;
994 goto fail_lpfree;
995 }
996
997 kfree(lp);