Lines Matching refs:ea_buf
145 static void ea_release(struct inode *inode, struct ea_buffer *ea_buf);
442 static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size) in ea_get() argument
458 ea_buf->flag = 0; in ea_get()
459 ea_buf->max_size = 0; in ea_get()
460 ea_buf->xattr = NULL; in ea_get()
465 ea_buf->flag = EA_INLINE | EA_NEW; in ea_get()
466 ea_buf->max_size = sizeof (ji->i_inline_ea); in ea_get()
467 ea_buf->xattr = (struct jfs_ea_list *) ji->i_inline_ea; in ea_get()
468 DXDlength(&ea_buf->new_ea, 0); in ea_get()
469 DXDaddress(&ea_buf->new_ea, 0); in ea_get()
470 ea_buf->new_ea.flag = DXD_INLINE; in ea_get()
471 DXDsize(&ea_buf->new_ea, min_size); in ea_get()
477 ea_buf->flag = EA_INLINE; in ea_get()
478 ea_buf->max_size = sizeof (ji->i_inline_ea); in ea_get()
479 ea_buf->xattr = (struct jfs_ea_list *) ji->i_inline_ea; in ea_get()
498 ea_buf->xattr = kmalloc(size, GFP_KERNEL); in ea_get()
499 if (ea_buf->xattr == NULL) in ea_get()
502 ea_buf->flag = EA_MALLOC; in ea_get()
503 ea_buf->max_size = (size + sb->s_blocksize - 1) & in ea_get()
509 if ((rc = ea_read(inode, ea_buf->xattr))) { in ea_get()
510 kfree(ea_buf->xattr); in ea_get()
511 ea_buf->xattr = NULL; in ea_get()
525 DXDlength(&ea_buf->new_ea, blocks_needed); in ea_get()
526 DXDaddress(&ea_buf->new_ea, blkno); in ea_get()
527 ea_buf->new_ea.flag = DXD_EXTENT; in ea_get()
528 DXDsize(&ea_buf->new_ea, min_size); in ea_get()
530 ea_buf->flag = EA_EXTENT | EA_NEW; in ea_get()
532 ea_buf->mp = get_metapage(inode, blkno, in ea_get()
535 if (ea_buf->mp == NULL) { in ea_get()
539 ea_buf->xattr = ea_buf->mp->data; in ea_get()
540 ea_buf->max_size = (min_size + sb->s_blocksize - 1) & in ea_get()
544 if ((rc = ea_read(inode, ea_buf->xattr))) { in ea_get()
545 discard_metapage(ea_buf->mp); in ea_get()
551 ea_buf->flag = EA_EXTENT; in ea_get()
552 ea_buf->mp = read_metapage(inode, addressDXD(&ji->ea), in ea_get()
555 if (ea_buf->mp == NULL) in ea_get()
557 ea_buf->xattr = ea_buf->mp->data; in ea_get()
558 ea_buf->max_size = (ea_size + sb->s_blocksize - 1) & in ea_get()
562 if (EALIST_SIZE(ea_buf->xattr) != ea_size) { in ea_get()
564 dump_mem("xattr", ea_buf->xattr, ea_size); in ea_get()
565 ea_release(inode, ea_buf); in ea_get()
572 static void ea_release(struct inode *inode, struct ea_buffer *ea_buf) in ea_release() argument
574 if (ea_buf->flag & EA_MALLOC) in ea_release()
575 kfree(ea_buf->xattr); in ea_release()
576 else if (ea_buf->flag & EA_EXTENT) { in ea_release()
577 assert(ea_buf->mp); in ea_release()
578 release_metapage(ea_buf->mp); in ea_release()
580 if (ea_buf->flag & EA_NEW) in ea_release()
581 dbFree(inode, addressDXD(&ea_buf->new_ea), in ea_release()
582 lengthDXD(&ea_buf->new_ea)); in ea_release()
586 static int ea_put(struct inode *inode, struct ea_buffer *ea_buf, int new_size) in ea_put() argument
594 ea_release(inode, ea_buf); in ea_put()
595 ea_buf = 0; in ea_put()
596 } else if (ea_buf->flag & EA_INLINE) { in ea_put()
599 ea_buf->new_ea.flag = DXD_INLINE; in ea_put()
600 DXDsize(&ea_buf->new_ea, new_size); in ea_put()
601 DXDaddress(&ea_buf->new_ea, 0); in ea_put()
602 DXDlength(&ea_buf->new_ea, 0); in ea_put()
603 } else if (ea_buf->flag & EA_MALLOC) { in ea_put()
604 rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea); in ea_put()
605 kfree(ea_buf->xattr); in ea_put()
606 } else if (ea_buf->flag & EA_NEW) { in ea_put()
608 flush_metapage(ea_buf->mp); in ea_put()
611 rc = ea_write(inode, ea_buf->xattr, new_size, &ea_buf->new_ea); in ea_put()
612 discard_metapage(ea_buf->mp); in ea_put()
627 if (ea_buf) { in ea_put()
628 txEA(tid, inode, &ji->ea, &ea_buf->new_ea); in ea_put()
629 if (ea_buf->new_ea.flag & DXD_EXTENT) { in ea_put()
630 new_blocks = lengthDXD(&ea_buf->new_ea); in ea_put()
634 ji->ea = ea_buf->new_ea; in ea_put()
676 struct ea_buffer ea_buf; in __jfs_setxattr() local
699 xattr_size = ea_get(inode, &ea_buf, 0); in __jfs_setxattr()
706 ealist = (struct jfs_ea_list *) ea_buf.xattr; in __jfs_setxattr()
740 if (new_size > ea_buf.max_size) { in __jfs_setxattr()
745 ea_release(inode, &ea_buf); in __jfs_setxattr()
746 xattr_size = ea_get(inode, &ea_buf, new_size); in __jfs_setxattr()
798 rc = ea_put(inode, &ea_buf, new_size); in __jfs_setxattr()
802 ea_release(inode, &ea_buf); in __jfs_setxattr()
833 struct ea_buffer ea_buf; in __jfs_getxattr() local
854 xattr_size = ea_get(inode, &ea_buf, 0); in __jfs_getxattr()
863 ealist = (struct jfs_ea_list *) ea_buf.xattr; in __jfs_getxattr()
884 ea_release(inode, &ea_buf); in __jfs_getxattr()
906 struct ea_buffer ea_buf; in jfs_listxattr() local
908 xattr_size = ea_get(inode, &ea_buf, 0); in jfs_listxattr()
917 ealist = (struct jfs_ea_list *) ea_buf.xattr; in jfs_listxattr()
939 ea_release(inode, &ea_buf); in jfs_listxattr()