MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sa_attr_register_sync

Function sa_attr_register_sync

freebsd/contrib/openzfs/module/zfs/sa.c:1773–1804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1771}
1772
1773static void
1774sa_attr_register_sync(sa_handle_t *hdl, dmu_tx_t *tx)
1775{
1776 uint64_t attr_value = 0;
1777 sa_os_t *sa = hdl->sa_os->os_sa;
1778 sa_attr_table_t *tb = sa->sa_attr_table;
1779 int i;
1780
1781 mutex_enter(&sa->sa_lock);
1782
1783 if (!sa->sa_need_attr_registration || sa->sa_master_obj == 0) {
1784 mutex_exit(&sa->sa_lock);
1785 return;
1786 }
1787
1788 if (sa->sa_reg_attr_obj == 0) {
1789 sa->sa_reg_attr_obj = zap_create_link(hdl->sa_os,
1790 DMU_OT_SA_ATTR_REGISTRATION,
1791 sa->sa_master_obj, SA_REGISTRY, tx);
1792 }
1793 for (i = 0; i != sa->sa_num_attrs; i++) {
1794 if (sa->sa_attr_table[i].sa_registered)
1795 continue;
1796 ATTR_ENCODE(attr_value, tb[i].sa_attr, tb[i].sa_length,
1797 tb[i].sa_byteswap);
1798 VERIFY(0 == zap_update(hdl->sa_os, sa->sa_reg_attr_obj,
1799 tb[i].sa_name, 8, 1, &attr_value, tx));
1800 tb[i].sa_registered = B_TRUE;
1801 }
1802 sa->sa_need_attr_registration = B_FALSE;
1803 mutex_exit(&sa->sa_lock);
1804}
1805
1806/*
1807 * Replace all attributes with attributes specified in template.

Callers 2

sa_bulk_update_implFunction · 0.85

Calls 4

mutex_enterFunction · 0.85
mutex_exitFunction · 0.85
zap_create_linkFunction · 0.85
zap_updateFunction · 0.85

Tested by

no test coverage detected