Lines Matching refs:ea
74 struct gfs2_ea_header *ea,
80 struct gfs2_ea_header *ea, *prev = NULL; in ea_foreach_i() local
86 for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) { in ea_foreach_i()
87 if (!GFS2_EA_REC_LEN(ea)) in ea_foreach_i()
89 if (!(bh->b_data <= (char *)ea && (char *)GFS2_EA2NEXT(ea) <= in ea_foreach_i()
92 if (!GFS2_EATYPE_VALID(ea->ea_type)) in ea_foreach_i()
95 error = ea_call(ip, bh, ea, prev, data); in ea_foreach_i()
99 if (GFS2_EA_IS_LAST(ea)) { in ea_foreach_i()
100 if ((char *)GFS2_EA2NEXT(ea) != in ea_foreach_i()
165 struct gfs2_ea_header *ea, struct gfs2_ea_header *prev, in ea_find_i() argument
170 if (ea->ea_type == GFS2_EATYPE_UNUSED) in ea_find_i()
173 if (ea->ea_type == ef->type) { in ea_find_i()
174 if (ea->ea_name_len == ef->namel && in ea_find_i()
175 !memcmp(GFS2_EA2NAME(ea), ef->name, ea->ea_name_len)) { in ea_find_i()
179 el->el_ea = ea; in ea_find_i()
224 struct gfs2_ea_header *ea, in ea_dealloc_unstuffed() argument
243 if (GFS2_EA_IS_STUFFED(ea)) in ea_dealloc_unstuffed()
246 dataptrs = GFS2_EA2DATAPTRS(ea); in ea_dealloc_unstuffed()
247 for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) { in ea_dealloc_unstuffed()
273 dataptrs = GFS2_EA2DATAPTRS(ea); in ea_dealloc_unstuffed()
274 for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) { in ea_dealloc_unstuffed()
297 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); in ea_dealloc_unstuffed()
300 if (GFS2_EA_IS_LAST(ea)) in ea_dealloc_unstuffed()
303 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_dealloc_unstuffed()
304 ea->ea_num_ptrs = 0; in ea_dealloc_unstuffed()
318 struct gfs2_ea_header *ea, in ea_remove_unstuffed() argument
331 error = ea_dealloc_unstuffed(ip, bh, ea, prev, (leave) ? &error : NULL); in ea_remove_unstuffed()
344 struct gfs2_ea_header *ea, struct gfs2_ea_header *prev, in ea_list_i() argument
353 if (ea->ea_type == GFS2_EATYPE_UNUSED) in ea_list_i()
356 switch (ea->ea_type) { in ea_list_i()
373 ea_size = l + ea->ea_name_len + 1; in ea_list_i()
379 memcpy(er->er_data + ei->ei_size + l, GFS2_EA2NAME(ea), in ea_list_i()
380 ea->ea_name_len); in ea_list_i()
439 static int gfs2_iter_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, in gfs2_iter_unstuffed() argument
444 unsigned int amount = GFS2_EA_DATA_LEN(ea); in gfs2_iter_unstuffed()
446 __be64 *dataptrs = GFS2_EA2DATAPTRS(ea); in gfs2_iter_unstuffed()
624 struct gfs2_ea_header *ea; in ea_alloc_blk() local
638 ea = GFS2_EA_BH2FIRST(*bhp); in ea_alloc_blk()
639 ea->ea_rec_len = cpu_to_be32(sdp->sd_jbsize); in ea_alloc_blk()
640 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_alloc_blk()
641 ea->ea_flags = GFS2_EAFLAG_LAST; in ea_alloc_blk()
642 ea->ea_num_ptrs = 0; in ea_alloc_blk()
661 static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, in ea_write() argument
667 ea->ea_data_len = cpu_to_be32(er->er_data_len); in ea_write()
668 ea->ea_name_len = er->er_name_len; in ea_write()
669 ea->ea_type = er->er_type; in ea_write()
670 ea->__pad = 0; in ea_write()
672 memcpy(GFS2_EA2NAME(ea), er->er_name, er->er_name_len); in ea_write()
675 ea->ea_num_ptrs = 0; in ea_write()
676 memcpy(GFS2_EA2DATA(ea), er->er_data, er->er_data_len); in ea_write()
678 __be64 *dataptr = GFS2_EA2DATAPTRS(ea); in ea_write()
684 ea->ea_num_ptrs = DIV_ROUND_UP(er->er_data_len, sdp->sd_jbsize); in ea_write()
685 for (x = 0; x < ea->ea_num_ptrs; x++) { in ea_write()
810 static struct gfs2_ea_header *ea_split_ea(struct gfs2_ea_header *ea) in ea_split_ea() argument
812 u32 ea_size = GFS2_EA_SIZE(ea); in ea_split_ea()
813 struct gfs2_ea_header *new = (struct gfs2_ea_header *)((char *)ea + in ea_split_ea()
815 u32 new_size = GFS2_EA_REC_LEN(ea) - ea_size; in ea_split_ea()
816 int last = ea->ea_flags & GFS2_EAFLAG_LAST; in ea_split_ea()
818 ea->ea_rec_len = cpu_to_be32(ea_size); in ea_split_ea()
819 ea->ea_flags ^= last; in ea_split_ea()
830 struct gfs2_ea_header *ea = el->el_ea; in ea_set_remove_stuffed() local
836 if (!prev || !GFS2_EA_IS_STUFFED(ea)) { in ea_set_remove_stuffed()
837 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_set_remove_stuffed()
839 } else if (GFS2_EA2NEXT(prev) != ea) { in ea_set_remove_stuffed()
841 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), GFS2_EA2NEXT(prev) == ea); in ea_set_remove_stuffed()
844 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); in ea_set_remove_stuffed()
847 if (GFS2_EA_IS_LAST(ea)) in ea_set_remove_stuffed()
862 struct gfs2_ea_header *ea, struct ea_set *es) in ea_set_simple_noalloc() argument
874 ea = ea_split_ea(ea); in ea_set_simple_noalloc()
876 ea_write(ip, ea, er); in ea_set_simple_noalloc()
892 struct gfs2_ea_header *ea = es->es_ea; in ea_set_simple_alloc() local
898 ea = ea_split_ea(ea); in ea_set_simple_alloc()
900 error = ea_write(ip, ea, er); in ea_set_simple_alloc()
911 struct gfs2_ea_header *ea, struct gfs2_ea_header *prev, in ea_set_simple() argument
922 if (ea->ea_type == GFS2_EATYPE_UNUSED) { in ea_set_simple()
923 if (GFS2_EA_REC_LEN(ea) < size) in ea_set_simple()
925 if (!GFS2_EA_IS_STUFFED(ea)) { in ea_set_simple()
926 error = ea_remove_unstuffed(ip, bh, ea, prev, 1); in ea_set_simple()
931 } else if (GFS2_EA_REC_LEN(ea) - GFS2_EA_SIZE(ea) >= size) in ea_set_simple()
937 error = ea_set_simple_noalloc(ip, bh, ea, es); in ea_set_simple()
944 es->es_ea = ea; in ea_set_simple()
1077 struct gfs2_ea_header *ea = el->el_ea; in ea_remove_stuffed() local
1090 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); in ea_remove_stuffed()
1093 if (GFS2_EA_IS_LAST(ea)) in ea_remove_stuffed()
1096 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_remove_stuffed()