• Home
  • Raw
  • Download

Lines Matching refs:dent

92 typedef int (*gfs2_dscan_t)(const struct gfs2_dirent *dent,
404 static inline int gfs2_dirent_sentinel(const struct gfs2_dirent *dent) in gfs2_dirent_sentinel() argument
406 return dent->de_inum.no_addr == 0 || dent->de_inum.no_formal_ino == 0; in gfs2_dirent_sentinel()
409 static inline int __gfs2_dirent_find(const struct gfs2_dirent *dent, in __gfs2_dirent_find() argument
412 if (!gfs2_dirent_sentinel(dent) && in __gfs2_dirent_find()
413 be32_to_cpu(dent->de_hash) == name->hash && in __gfs2_dirent_find()
414 be16_to_cpu(dent->de_name_len) == name->len && in __gfs2_dirent_find()
415 memcmp(dent+1, name->name, name->len) == 0) in __gfs2_dirent_find()
420 static int gfs2_dirent_find(const struct gfs2_dirent *dent, in gfs2_dirent_find() argument
424 return __gfs2_dirent_find(dent, name, 1); in gfs2_dirent_find()
427 static int gfs2_dirent_prev(const struct gfs2_dirent *dent, in gfs2_dirent_prev() argument
431 return __gfs2_dirent_find(dent, name, 2); in gfs2_dirent_prev()
438 static int gfs2_dirent_last(const struct gfs2_dirent *dent, in gfs2_dirent_last() argument
443 const char *end = (const char *)dent + be16_to_cpu(dent->de_rec_len); in gfs2_dirent_last()
451 static int gfs2_dirent_find_offset(const struct gfs2_dirent *dent, in gfs2_dirent_find_offset() argument
456 unsigned actual = GFS2_DIRENT_SIZE(be16_to_cpu(dent->de_name_len)); in gfs2_dirent_find_offset()
457 unsigned totlen = be16_to_cpu(dent->de_rec_len); in gfs2_dirent_find_offset()
459 if (ptr < (void *)dent || ptr >= (void *)dent + totlen) in gfs2_dirent_find_offset()
461 if (gfs2_dirent_sentinel(dent)) in gfs2_dirent_find_offset()
463 if (ptr < (void *)dent + actual) in gfs2_dirent_find_offset()
465 if ((void *)dent + totlen >= ptr + required) in gfs2_dirent_find_offset()
470 static int gfs2_dirent_find_space(const struct gfs2_dirent *dent, in gfs2_dirent_find_space() argument
475 unsigned actual = GFS2_DIRENT_SIZE(be16_to_cpu(dent->de_name_len)); in gfs2_dirent_find_space()
476 unsigned totlen = be16_to_cpu(dent->de_rec_len); in gfs2_dirent_find_space()
478 if (gfs2_dirent_sentinel(dent)) in gfs2_dirent_find_space()
490 static int gfs2_dirent_gather(const struct gfs2_dirent *dent, in gfs2_dirent_gather() argument
495 if (!gfs2_dirent_sentinel(dent)) { in gfs2_dirent_gather()
496 g->pdent[g->offset++] = dent; in gfs2_dirent_gather()
510 static int gfs2_check_dirent(struct gfs2_dirent *dent, unsigned int offset, in gfs2_check_dirent() argument
523 if (unlikely(!first && gfs2_dirent_sentinel(dent))) in gfs2_check_dirent()
526 if (!gfs2_dirent_sentinel(dent) && in gfs2_check_dirent()
527 unlikely(sizeof(struct gfs2_dirent)+be16_to_cpu(dent->de_name_len) > in gfs2_check_dirent()
565 struct gfs2_dirent *dent, *prev; in gfs2_dirent_scan() local
576 dent = buf + offset; in gfs2_dirent_scan()
577 size = be16_to_cpu(dent->de_rec_len); in gfs2_dirent_scan()
578 if (gfs2_check_dirent(dent, offset, size, len, 1)) in gfs2_dirent_scan()
581 ret = scan(dent, name, opaque); in gfs2_dirent_scan()
587 prev = dent; in gfs2_dirent_scan()
588 dent = buf + offset; in gfs2_dirent_scan()
589 size = be16_to_cpu(dent->de_rec_len); in gfs2_dirent_scan()
590 if (gfs2_check_dirent(dent, offset, size, len, 0)) in gfs2_dirent_scan()
598 return dent; in gfs2_dirent_scan()
600 return prev ? prev : dent; in gfs2_dirent_scan()
639 struct gfs2_dirent **dent) in dirent_next() argument
641 struct gfs2_dirent *cur = *dent, *tmp; in dirent_next()
660 *dent = tmp; in dirent_next()
711 struct gfs2_dirent *dent, in do_init_dirent() argument
720 totlen = be16_to_cpu(dent->de_rec_len); in do_init_dirent()
723 ndent = (struct gfs2_dirent *)((char *)dent + offset); in do_init_dirent()
724 dent->de_rec_len = cpu_to_be16(offset); in do_init_dirent()
735 struct gfs2_dirent *dent, in gfs2_init_dirent() argument
741 if (!gfs2_dirent_sentinel(dent)) in gfs2_init_dirent()
742 offset = GFS2_DIRENT_SIZE(be16_to_cpu(dent->de_name_len)); in gfs2_init_dirent()
743 return do_init_dirent(inode, dent, name, bh, offset); in gfs2_init_dirent()
751 struct gfs2_dirent *dent; in gfs2_dirent_split_alloc() local
752 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, in gfs2_dirent_split_alloc()
754 if (!dent || IS_ERR(dent)) in gfs2_dirent_split_alloc()
755 return dent; in gfs2_dirent_split_alloc()
756 return do_init_dirent(inode, dent, name, bh, in gfs2_dirent_split_alloc()
757 (unsigned)(ptr - (void *)dent)); in gfs2_dirent_split_alloc()
817 struct gfs2_dirent *dent; in gfs2_dirent_search() local
836 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, in gfs2_dirent_search()
838 if (dent) in gfs2_dirent_search()
856 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL); in gfs2_dirent_search()
858 if (unlikely(dent == NULL || IS_ERR(dent))) { in gfs2_dirent_search()
863 return dent; in gfs2_dirent_search()
874 struct gfs2_dirent *dent; in new_leaf() local
897 dent = (struct gfs2_dirent *)(leaf+1); in new_leaf()
898 gfs2_qstr2dirent(&empty_name, bh->b_size - sizeof(struct gfs2_leaf), dent); in new_leaf()
914 struct gfs2_dirent *dent; in dir_make_exhash() local
949 dent = gfs2_dirent_scan(&dip->i_inode, bh->b_data, bh->b_size, in dir_make_exhash()
951 if (!dent) { in dir_make_exhash()
956 if (IS_ERR(dent)) { in dir_make_exhash()
959 return PTR_ERR(dent); in dir_make_exhash()
965 dent->de_rec_len = cpu_to_be16(be16_to_cpu(dent->de_rec_len) + in dir_make_exhash()
1010 struct gfs2_dirent *dent = NULL, *prev = NULL, *next = NULL, *new; in dir_split_leaf() local
1085 dent = (struct gfs2_dirent *)(obh->b_data + sizeof(struct gfs2_leaf)); in dir_split_leaf()
1088 next = dent; in dir_split_leaf()
1092 if (!gfs2_dirent_sentinel(dent) && in dir_split_leaf()
1093 be32_to_cpu(dent->de_hash) < divider) { in dir_split_leaf()
1095 void *ptr = ((char *)dent - obh->b_data) + nbh->b_data; in dir_split_leaf()
1096 str.name = (char*)(dent+1); in dir_split_leaf()
1097 str.len = be16_to_cpu(dent->de_name_len); in dir_split_leaf()
1098 str.hash = be32_to_cpu(dent->de_hash); in dir_split_leaf()
1105 new->de_inum = dent->de_inum; /* No endian worries */ in dir_split_leaf()
1106 new->de_type = dent->de_type; /* No endian worries */ in dir_split_leaf()
1109 dirent_del(dip, obh, prev, dent); in dir_split_leaf()
1116 prev = dent; in dir_split_leaf()
1120 prev = dent; in dir_split_leaf()
1122 dent = next; in dir_split_leaf()
1123 } while (dent); in dir_split_leaf()
1275 const struct gfs2_dirent *dent, *dent_next; in do_filldir_main() local
1288 dent = dent_next; in do_filldir_main()
1311 if (!dir_emit(ctx, (const char *)(dent + 1), in do_filldir_main()
1312 be16_to_cpu(dent->de_name_len), in do_filldir_main()
1313 be64_to_cpu(dent->de_inum.no_addr), in do_filldir_main()
1314 be16_to_cpu(dent->de_type))) in do_filldir_main()
1384 struct gfs2_dirent **darr, *dent; in gfs2_dir_read_leaf() local
1435 dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, in gfs2_dir_read_leaf()
1437 error = PTR_ERR(dent); in gfs2_dir_read_leaf()
1438 if (IS_ERR(dent)) in gfs2_dir_read_leaf()
1578 struct gfs2_dirent **darr, *dent; in gfs2_dir_read() local
1604 dent = gfs2_dirent_scan(inode, dibh->b_data, dibh->b_size, in gfs2_dir_read()
1606 if (IS_ERR(dent)) { in gfs2_dir_read()
1607 error = PTR_ERR(dent); in gfs2_dir_read()
1651 struct gfs2_dirent *dent; in gfs2_dir_search() local
1655 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); in gfs2_dir_search()
1656 if (dent) { in gfs2_dir_search()
1660 if (IS_ERR(dent)) in gfs2_dir_search()
1661 return ERR_CAST(dent); in gfs2_dir_search()
1662 dtype = be16_to_cpu(dent->de_type); in gfs2_dir_search()
1663 rahead = be16_to_cpu(dent->de_rahead); in gfs2_dir_search()
1664 addr = be64_to_cpu(dent->de_inum.no_addr); in gfs2_dir_search()
1665 formal_ino = be64_to_cpu(dent->de_inum.no_formal_ino); in gfs2_dir_search()
1682 struct gfs2_dirent *dent; in gfs2_dir_check() local
1685 dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); in gfs2_dir_check()
1686 if (dent) { in gfs2_dir_check()
1687 if (IS_ERR(dent)) in gfs2_dir_check()
1688 return PTR_ERR(dent); in gfs2_dir_check()
1690 if (be64_to_cpu(dent->de_inum.no_addr) != ip->i_no_addr) in gfs2_dir_check()
1692 if (be64_to_cpu(dent->de_inum.no_formal_ino) != in gfs2_dir_check()
1696 be16_to_cpu(dent->de_type))) { in gfs2_dir_check()
1805 struct gfs2_dirent *dent = da->dent; in gfs2_dir_add() local
1812 dent = gfs2_dirent_search(inode, name, in gfs2_dir_add()
1815 if (dent) { in gfs2_dir_add()
1816 if (IS_ERR(dent)) in gfs2_dir_add()
1817 return PTR_ERR(dent); in gfs2_dir_add()
1818 dent = gfs2_init_dirent(inode, dent, name, bh); in gfs2_dir_add()
1819 gfs2_inum_out(nip, dent); in gfs2_dir_add()
1820 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode)); in gfs2_dir_add()
1821 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip)); in gfs2_dir_add()
1829 da->dent = NULL; in gfs2_dir_add()
1882 struct gfs2_dirent *dent, *prev = NULL; in gfs2_dir_del() local
1888 dent = gfs2_dirent_search(&dip->i_inode, name, gfs2_dirent_prev, &bh); in gfs2_dir_del()
1889 if (!dent) { in gfs2_dir_del()
1893 if (IS_ERR(dent)) { in gfs2_dir_del()
1895 return PTR_ERR(dent); in gfs2_dir_del()
1898 if (gfs2_dirent_find(dent, name, NULL) == 0) { in gfs2_dir_del()
1899 prev = dent; in gfs2_dir_del()
1900 dent = (struct gfs2_dirent *)((char *)dent + be16_to_cpu(prev->de_rec_len)); in gfs2_dir_del()
1903 dirent_del(dip, bh, prev, dent); in gfs2_dir_del()
1943 struct gfs2_dirent *dent; in gfs2_dir_mvino() local
1946 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh); in gfs2_dir_mvino()
1947 if (!dent) { in gfs2_dir_mvino()
1951 if (IS_ERR(dent)) in gfs2_dir_mvino()
1952 return PTR_ERR(dent); in gfs2_dir_mvino()
1955 gfs2_inum_out(nip, dent); in gfs2_dir_mvino()
1956 dent->de_type = cpu_to_be16(new_type); in gfs2_dir_mvino()
2171 struct gfs2_dirent *dent; in gfs2_diradd_alloc_required() local
2176 da->dent = NULL; in gfs2_diradd_alloc_required()
2178 dent = gfs2_dirent_search(inode, name, gfs2_dirent_find_space, &bh); in gfs2_diradd_alloc_required()
2179 if (!dent) { in gfs2_diradd_alloc_required()
2186 if (IS_ERR(dent)) in gfs2_diradd_alloc_required()
2187 return PTR_ERR(dent); in gfs2_diradd_alloc_required()
2191 da->dent = dent; in gfs2_diradd_alloc_required()