Deleted Added
full compact
zap_micro.c (307287) zap_micro.c (307292)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 519 unchanged lines hidden (view full) ---

528 zap->zap_m.zap_num_chunks =
529 db->db_size / MZAP_ENT_LEN - 1;
530 }
531
532 *zapp = zap;
533 return (0);
534}
535
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 519 unchanged lines hidden (view full) ---

528 zap->zap_m.zap_num_chunks =
529 db->db_size / MZAP_ENT_LEN - 1;
530 }
531
532 *zapp = zap;
533 return (0);
534}
535
536static int
537zap_lockdir_by_dnode(dnode_t *dn, dmu_tx_t *tx,
538 krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp)
539{
540 dmu_buf_t *db;
541 int err;
542
543 err = dmu_buf_hold_by_dnode(dn, 0, tag, &db, DMU_READ_NO_PREFETCH);
544 if (err != 0) {
545 return (err);
546 }
547 err = zap_lockdir_impl(db, tag, tx, lti, fatreader, adding, zapp);
548 if (err != 0) {
549 dmu_buf_rele(db, tag);
550 }
551 return (err);
552}
553
536int
537zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx,
538 krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp)
539{
540 dmu_buf_t *db;
541 int err;
542
543 err = dmu_buf_hold(os, obj, 0, tag, &db, DMU_READ_NO_PREFETCH);

--- 309 unchanged lines hidden (view full) ---

853 return (err);
854 err = zap_lookup_impl(zap, name, integer_size,
855 num_integers, buf, mt, realname, rn_len, ncp);
856 zap_unlockdir(zap, FTAG);
857 return (err);
858}
859
860int
554int
555zap_lockdir(objset_t *os, uint64_t obj, dmu_tx_t *tx,
556 krw_t lti, boolean_t fatreader, boolean_t adding, void *tag, zap_t **zapp)
557{
558 dmu_buf_t *db;
559 int err;
560
561 err = dmu_buf_hold(os, obj, 0, tag, &db, DMU_READ_NO_PREFETCH);

--- 309 unchanged lines hidden (view full) ---

871 return (err);
872 err = zap_lookup_impl(zap, name, integer_size,
873 num_integers, buf, mt, realname, rn_len, ncp);
874 zap_unlockdir(zap, FTAG);
875 return (err);
876}
877
878int
879zap_lookup_by_dnode(dnode_t *dn, const char *name,
880 uint64_t integer_size, uint64_t num_integers, void *buf)
881{
882 return (zap_lookup_norm_by_dnode(dn, name, integer_size,
883 num_integers, buf, MT_EXACT, NULL, 0, NULL));
884}
885
886int
887zap_lookup_norm_by_dnode(dnode_t *dn, const char *name,
888 uint64_t integer_size, uint64_t num_integers, void *buf,
889 matchtype_t mt, char *realname, int rn_len,
890 boolean_t *ncp)
891{
892 zap_t *zap;
893 int err;
894
895 err = zap_lockdir_by_dnode(dn, NULL, RW_READER, TRUE, FALSE,
896 FTAG, &zap);
897 if (err != 0)
898 return (err);
899 err = zap_lookup_impl(zap, name, integer_size,
900 num_integers, buf, mt, realname, rn_len, ncp);
901 zap_unlockdir(zap, FTAG);
902 return (err);
903}
904
905int
861zap_prefetch_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key,
862 int key_numints)
863{
864 zap_t *zap;
865 int err;
866 zap_name_t *zn;
867
868 err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap);

--- 554 unchanged lines hidden (view full) ---

1423 } else {
1424 fzap_get_stats(zap, zs);
1425 }
1426 zap_unlockdir(zap, FTAG);
1427 return (0);
1428}
1429
1430int
906zap_prefetch_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key,
907 int key_numints)
908{
909 zap_t *zap;
910 int err;
911 zap_name_t *zn;
912
913 err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE, FTAG, &zap);

--- 554 unchanged lines hidden (view full) ---

1468 } else {
1469 fzap_get_stats(zap, zs);
1470 }
1471 zap_unlockdir(zap, FTAG);
1472 return (0);
1473}
1474
1475int
1431zap_count_write(objset_t *os, uint64_t zapobj, const char *name, int add,
1476zap_count_write_by_dnode(dnode_t *dn, const char *name, int add,
1432 refcount_t *towrite, refcount_t *tooverwrite)
1433{
1434 zap_t *zap;
1435 int err = 0;
1436
1437 /*
1438 * Since, we don't have a name, we cannot figure out which blocks will
1439 * be affected in this operation. So, account for the worst case :

--- 12 unchanged lines hidden (view full) ---

1452 }
1453
1454 /*
1455 * We lock the zap with adding == FALSE. Because, if we pass
1456 * the actual value of add, it could trigger a mzap_upgrade().
1457 * At present we are just evaluating the possibility of this operation
1458 * and hence we do not want to trigger an upgrade.
1459 */
1477 refcount_t *towrite, refcount_t *tooverwrite)
1478{
1479 zap_t *zap;
1480 int err = 0;
1481
1482 /*
1483 * Since, we don't have a name, we cannot figure out which blocks will
1484 * be affected in this operation. So, account for the worst case :

--- 12 unchanged lines hidden (view full) ---

1497 }
1498
1499 /*
1500 * We lock the zap with adding == FALSE. Because, if we pass
1501 * the actual value of add, it could trigger a mzap_upgrade().
1502 * At present we are just evaluating the possibility of this operation
1503 * and hence we do not want to trigger an upgrade.
1504 */
1460 err = zap_lockdir(os, zapobj, NULL, RW_READER, TRUE, FALSE,
1505 err = zap_lockdir_by_dnode(dn, NULL, RW_READER, TRUE, FALSE,
1461 FTAG, &zap);
1462 if (err != 0)
1463 return (err);
1464
1465 if (!zap->zap_ismicro) {
1466 zap_name_t *zn = zap_name_alloc(zap, name, MT_EXACT);
1467 if (zn) {
1468 err = fzap_count_write(zn, add, towrite,

--- 42 unchanged lines hidden ---
1506 FTAG, &zap);
1507 if (err != 0)
1508 return (err);
1509
1510 if (!zap->zap_ismicro) {
1511 zap_name_t *zn = zap_name_alloc(zap, name, MT_EXACT);
1512 if (zn) {
1513 err = fzap_count_write(zn, add, towrite,

--- 42 unchanged lines hidden ---