Lines Matching refs:ea_buf
119 static void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
426 static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size) in ea_get() argument
443 ea_buf->flag = 0; in ea_get()
444 ea_buf->max_size = 0; in ea_get()
445 ea_buf->xattr = NULL; in ea_get()
450 ea_buf->flag = EA_INLINE | EA_NEW; in ea_get()
451 ea_buf->max_size = sizeof (ji->i_inline_ea); in ea_get()
452 ea_buf->xattr = (struct jfs_ea_list *) ji->i_inline_ea; in ea_get()
453 DXDlength(&ea_buf->new_ea, 0); in ea_get()
454 DXDaddress(&ea_buf->new_ea, 0); in ea_get()
455 ea_buf->new_ea.flag = DXD_INLINE; in ea_get()
456 DXDsize(&ea_buf->new_ea, min_size); in ea_get()
462 ea_buf->flag = EA_INLINE; in ea_get()
463 ea_buf->max_size = sizeof (ji->i_inline_ea); in ea_get()
464 ea_buf->xattr = (struct jfs_ea_list *) ji->i_inline_ea; in ea_get()
484 ea_buf->max_size = (size + sb->s_blocksize - 1) & in ea_get()
487 ea_buf->xattr = kmalloc(ea_buf->max_size, GFP_KERNEL); in ea_get()
488 if (ea_buf->xattr == NULL) in ea_get()
491 ea_buf->flag = EA_MALLOC; in ea_get()
496 if ((rc = ea_read(inode, ea_buf->xattr))) { in ea_get()
497 kfree(ea_buf->xattr); in ea_get()
498 ea_buf->xattr = NULL; in ea_get()
519 DXDlength(&ea_buf->new_ea, blocks_needed); in ea_get()
520 DXDaddress(&ea_buf->new_ea, blkno); in ea_get()
521 ea_buf->new_ea.flag = DXD_EXTENT; in ea_get()
522 DXDsize(&ea_buf->new_ea, min_size); in ea_get()
524 ea_buf->flag = EA_EXTENT | EA_NEW; in ea_get()
526 ea_buf->mp = get_metapage(inode, blkno, in ea_get()
529 if (ea_buf->mp == NULL) { in ea_get()
534 ea_buf->xattr = ea_buf->mp->data; in ea_get()
535 ea_buf->max_size = (min_size + sb->s_blocksize - 1) & in ea_get()
539 if ((rc = ea_read(inode, ea_buf->xattr))) { in ea_get()
540 discard_metapage(ea_buf->mp); in ea_get()
546 ea_buf->flag = EA_EXTENT; in ea_get()
547 ea_buf->mp = read_metapage(inode, addressDXD(&ji->ea), in ea_get()
550 if (ea_buf->mp == NULL) { in ea_get()
554 ea_buf->xattr = ea_buf->mp->data; in ea_get()
555 ea_buf->max_size = (ea_size + sb->s_blocksize - 1) & in ea_get()
559 if (EALIST_SIZE(ea_buf->xattr) != ea_size) { in ea_get()
562 ea_buf->xattr, ea_size, 1); in ea_get()
563 ea_release(inode, ea_buf); in ea_get()
578 static void ea_release(struct inode *inode, struct ea_buffer *ea_buf) in ea_release() argument
580 if (ea_buf->flag & EA_MALLOC) in ea_release()
581 kfree(ea_buf->xattr); in ea_release()
582 else if (ea_buf->flag & EA_EXTENT) { in ea_release()
583 assert(ea_buf->mp); in ea_release()
584 release_metapage(ea_buf->mp); in ea_release()
586 if (ea_buf->flag & EA_NEW) in ea_release()
587 dbFree(inode, addressDXD(&ea_buf->new_ea), in ea_release()
588 lengthDXD(&ea_buf->new_ea)); in ea_release()
592 static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf, in ea_put() argument
600 ea_release(inode, ea_buf); in ea_put()
601 ea_buf = NULL; in ea_put()
602 } else if (ea_buf->flag & EA_INLINE) { in ea_put()
605 ea_buf->new_ea.flag = DXD_INLINE; in ea_put()
606 DXDsize(&ea_buf->new_ea, new_size); in ea_put()
607 DXDaddress(&ea_buf->new_ea, 0); in ea_put()
608 DXDlength(&ea_buf->new_ea, 0); in ea_put()
609 } else if (ea_buf->flag & EA_MALLOC) { in ea_put()
610 rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea); in ea_put()
611 kfree(ea_buf->xattr); in ea_put()
612 } else if (ea_buf->flag & EA_NEW) { in ea_put()
614 flush_metapage(ea_buf->mp); in ea_put()
617 rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea); in ea_put()
618 discard_metapage(ea_buf->mp); in ea_put()
630 if (ea_buf) { in ea_put()
631 txEA(tid, inode, &ji->ea, &ea_buf->new_ea); in ea_put()
632 if (ea_buf->new_ea.flag & DXD_EXTENT) { in ea_put()
633 new_blocks = lengthDXD(&ea_buf->new_ea); in ea_put()
637 ji->ea = ea_buf->new_ea; in ea_put()
660 struct ea_buffer ea_buf; in __jfs_setxattr() local
671 xattr_size = ea_get(inode, &ea_buf, 0); in __jfs_setxattr()
678 ealist = (struct jfs_ea_list *) ea_buf.xattr; in __jfs_setxattr()
712 if (new_size > ea_buf.max_size) { in __jfs_setxattr()
717 ea_release(inode, &ea_buf); in __jfs_setxattr()
718 xattr_size = ea_get(inode, &ea_buf, new_size); in __jfs_setxattr()
783 rc = ea_put(tid, inode, &ea_buf, new_size); in __jfs_setxattr()
787 ea_release(inode, &ea_buf); in __jfs_setxattr()
799 struct ea_buffer ea_buf; in __jfs_getxattr() local
807 xattr_size = ea_get(inode, &ea_buf, 0); in __jfs_getxattr()
817 ealist = (struct jfs_ea_list *) ea_buf.xattr; in __jfs_getxattr()
838 ea_release(inode, &ea_buf); in __jfs_getxattr()
863 struct ea_buffer ea_buf; in jfs_listxattr() local
867 xattr_size = ea_get(inode, &ea_buf, 0); in jfs_listxattr()
876 ealist = (struct jfs_ea_list *) ea_buf.xattr; in jfs_listxattr()
902 ea_release(inode, &ea_buf); in jfs_listxattr()