Lines Matching refs:ea
85 struct gfs2_ea_header *ea,
92 struct gfs2_ea_header *ea, *prev = NULL; in ea_foreach_i() local
98 for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) { in ea_foreach_i()
99 if (!GFS2_EA_REC_LEN(ea)) in ea_foreach_i()
101 if (!(bh->b_data <= (char *)ea && (char *)GFS2_EA2NEXT(ea) <= in ea_foreach_i()
104 if (!gfs2_eatype_valid(sdp, ea->ea_type)) in ea_foreach_i()
106 error = ea_call(ip, bh, ea, prev, data); in ea_foreach_i()
110 if (GFS2_EA_IS_LAST(ea)) { in ea_foreach_i()
111 if ((char *)GFS2_EA2NEXT(ea) != in ea_foreach_i()
176 struct gfs2_ea_header *ea, struct gfs2_ea_header *prev, in ea_find_i() argument
181 if (ea->ea_type == GFS2_EATYPE_UNUSED) in ea_find_i()
184 if (ea->ea_type == ef->type) { in ea_find_i()
185 if (ea->ea_name_len == ef->namel && in ea_find_i()
186 !memcmp(GFS2_EA2NAME(ea), ef->name, ea->ea_name_len)) { in ea_find_i()
190 el->el_ea = ea; in ea_find_i()
230 struct gfs2_ea_header *ea, in ea_dealloc_unstuffed() argument
249 if (GFS2_EA_IS_STUFFED(ea)) in ea_dealloc_unstuffed()
252 dataptrs = GFS2_EA2DATAPTRS(ea); in ea_dealloc_unstuffed()
253 for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) { in ea_dealloc_unstuffed()
280 dataptrs = GFS2_EA2DATAPTRS(ea); in ea_dealloc_unstuffed()
281 for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) { in ea_dealloc_unstuffed()
304 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); in ea_dealloc_unstuffed()
307 if (GFS2_EA_IS_LAST(ea)) in ea_dealloc_unstuffed()
310 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_dealloc_unstuffed()
311 ea->ea_num_ptrs = 0; in ea_dealloc_unstuffed()
325 struct gfs2_ea_header *ea, in ea_remove_unstuffed() argument
338 error = ea_dealloc_unstuffed(ip, bh, ea, prev, (leave) ? &error : NULL); in ea_remove_unstuffed()
351 struct gfs2_ea_header *ea, struct gfs2_ea_header *prev, in ea_list_i() argument
361 if (ea->ea_type == GFS2_EATYPE_UNUSED) in ea_list_i()
364 BUG_ON(ea->ea_type > GFS2_EATYPE_SECURITY && in ea_list_i()
366 switch (ea->ea_type) { in ea_list_i()
387 ea_size = l + ea->ea_name_len + 1; in ea_list_i()
393 memcpy(er->er_data + ei->ei_size + l, GFS2_EA2NAME(ea), in ea_list_i()
394 ea->ea_name_len); in ea_list_i()
453 static int gfs2_iter_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea, in gfs2_iter_unstuffed() argument
458 unsigned int amount = GFS2_EA_DATA_LEN(ea); in gfs2_iter_unstuffed()
460 __be64 *dataptrs = GFS2_EA2DATAPTRS(ea); in gfs2_iter_unstuffed()
637 struct gfs2_ea_header *ea; in ea_alloc_blk() local
651 ea = GFS2_EA_BH2FIRST(*bhp); in ea_alloc_blk()
652 ea->ea_rec_len = cpu_to_be32(sdp->sd_jbsize); in ea_alloc_blk()
653 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_alloc_blk()
654 ea->ea_flags = GFS2_EAFLAG_LAST; in ea_alloc_blk()
655 ea->ea_num_ptrs = 0; in ea_alloc_blk()
674 static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea, in ea_write() argument
680 ea->ea_data_len = cpu_to_be32(er->er_data_len); in ea_write()
681 ea->ea_name_len = er->er_name_len; in ea_write()
682 ea->ea_type = er->er_type; in ea_write()
683 ea->__pad = 0; in ea_write()
685 memcpy(GFS2_EA2NAME(ea), er->er_name, er->er_name_len); in ea_write()
688 ea->ea_num_ptrs = 0; in ea_write()
689 memcpy(GFS2_EA2DATA(ea), er->er_data, er->er_data_len); in ea_write()
691 __be64 *dataptr = GFS2_EA2DATAPTRS(ea); in ea_write()
697 ea->ea_num_ptrs = DIV_ROUND_UP(er->er_data_len, sdp->sd_jbsize); in ea_write()
698 for (x = 0; x < ea->ea_num_ptrs; x++) { in ea_write()
820 static struct gfs2_ea_header *ea_split_ea(struct gfs2_ea_header *ea) in ea_split_ea() argument
822 u32 ea_size = GFS2_EA_SIZE(ea); in ea_split_ea()
823 struct gfs2_ea_header *new = (struct gfs2_ea_header *)((char *)ea + in ea_split_ea()
825 u32 new_size = GFS2_EA_REC_LEN(ea) - ea_size; in ea_split_ea()
826 int last = ea->ea_flags & GFS2_EAFLAG_LAST; in ea_split_ea()
828 ea->ea_rec_len = cpu_to_be32(ea_size); in ea_split_ea()
829 ea->ea_flags ^= last; in ea_split_ea()
840 struct gfs2_ea_header *ea = el->el_ea; in ea_set_remove_stuffed() local
846 if (!prev || !GFS2_EA_IS_STUFFED(ea)) { in ea_set_remove_stuffed()
847 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_set_remove_stuffed()
849 } else if (GFS2_EA2NEXT(prev) != ea) { in ea_set_remove_stuffed()
851 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), GFS2_EA2NEXT(prev) == ea); in ea_set_remove_stuffed()
854 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); in ea_set_remove_stuffed()
857 if (GFS2_EA_IS_LAST(ea)) in ea_set_remove_stuffed()
872 struct gfs2_ea_header *ea, struct ea_set *es) in ea_set_simple_noalloc() argument
884 ea = ea_split_ea(ea); in ea_set_simple_noalloc()
886 ea_write(ip, ea, er); in ea_set_simple_noalloc()
902 struct gfs2_ea_header *ea = es->es_ea; in ea_set_simple_alloc() local
908 ea = ea_split_ea(ea); in ea_set_simple_alloc()
910 error = ea_write(ip, ea, er); in ea_set_simple_alloc()
921 struct gfs2_ea_header *ea, struct gfs2_ea_header *prev, in ea_set_simple() argument
932 if (ea->ea_type == GFS2_EATYPE_UNUSED) { in ea_set_simple()
933 if (GFS2_EA_REC_LEN(ea) < size) in ea_set_simple()
935 if (!GFS2_EA_IS_STUFFED(ea)) { in ea_set_simple()
936 error = ea_remove_unstuffed(ip, bh, ea, prev, 1); in ea_set_simple()
941 } else if (GFS2_EA_REC_LEN(ea) - GFS2_EA_SIZE(ea) >= size) in ea_set_simple()
947 error = ea_set_simple_noalloc(ip, bh, ea, es); in ea_set_simple()
954 es->es_ea = ea; in ea_set_simple()
1087 struct gfs2_ea_header *ea = el->el_ea; in ea_remove_stuffed() local
1100 len = GFS2_EA_REC_LEN(prev) + GFS2_EA_REC_LEN(ea); in ea_remove_stuffed()
1103 if (GFS2_EA_IS_LAST(ea)) in ea_remove_stuffed()
1106 ea->ea_type = GFS2_EATYPE_UNUSED; in ea_remove_stuffed()