{"action":"created","comment":{"url":"https://api.github.com/repos/openzfs/openzfs/pulls/comments/99495176","pull_request_review_id":20174486,"id":99495176,"diff_hunk":"@@ -2142,6 +2175,117 @@ dump_label_uberblocks(vdev_label_t *lbl, uint64_t ashift)\n }\n \n static int\n+dump_specific_path(objset_t *os, uint64_t obj)\n+{\n+\tint print_header = 1;\n+\n+\tdump_object(os, obj, dump_opt['v'], &print_header);\n+\n+\treturn (0);\n+}\n+\n+static int\n+dump_specific_dir(objset_t *os, uint64_t obj, char *topname, char *name)\n+{\n+\tint err;\n+\tuint64_t child_obj;\n+\tchar *slash = strchr(name, '/');\n+\tchar *namep = name;\n+\tdmu_buf_t *db;\n+\tdmu_object_info_t doi;\n+\n+\tif (slash != NULL)\n+\t\t*slash = '\\0';\n+\terr = zap_lookup(os, obj, namep, 8, 1, &child_obj);\n+\tif (slash != NULL)\n+\t\t*slash = '/';\n+\n+\tif (err != 0) {\n+\t\t(void) fprintf(stderr, \"failed to lookup '%s': %s\\n\",\n+\t\t    name, strerror(err));\n+\t\treturn (err);\n+\t}\n+\n+\tchild_obj = ZFS_DIRENT_OBJ(child_obj);\n+\terr = sa_buf_hold(os, child_obj, FTAG, &db);\n+\tif (err != 0) {\n+\t\t(void) fprintf(stderr,\n+\t\t    \"failed to get SA dbuf for obj %llu: %s\\n\",\n+\t\t    (u_longlong_t)obj, strerror(err));\n+\t\treturn (EINVAL);\n+\t}\n+\tdmu_object_info_from_db(db, &doi);\n+\tsa_buf_rele(db, FTAG);\n+\n+\tif (dump_opt['v'] > 6) {\n+\t\t(void) fprintf(stderr, \"%s: obj %llu name '%s' type %d \"\n+\t\t    \"bonustype %d\\n\", __func__, (u_longlong_t)obj, name,\n+\t\t    doi.doi_type, doi.doi_bonus_type);\n+\t}\n+\n+\tif (doi.doi_bonus_type != DMU_OT_SA &&\n+\t    doi.doi_bonus_type != DMU_OT_ZNODE) {\n+\t\t(void) fprintf(stderr, \"invalid bonus type %d for obj %llu\\n\",\n+\t\t    doi.doi_bonus_type, (u_longlong_t)obj);\n+\t\treturn (EINVAL);\n+\t}\n+\n+\tswitch (doi.doi_type) {\n+\tcase DMU_OT_PLAIN_FILE_CONTENTS:\n+\t\tif (slash != NULL) {\n+\t\t\t*slash = '\\0';\n+\t\t\t(void) fprintf(stderr, \"error: path '/%s' specifies \"\n+\t\t\t    \"a file\\n\", topname);","path":"usr/src/cmd/zdb/zdb.c","position":273,"original_position":273,"commit_id":"3c60ca23d22af50a517e0b42014ae23a5e32e949","original_commit_id":"3c60ca23d22af50a517e0b42014ae23a5e32e949","user":{"login":"yuripv","id":1367473,"avatar_url":"https://avatars.githubusercontent.com/u/1367473?v=3","gravatar_id":"","url":"https://api.github.com/users/yuripv","html_url":"https://github.com/yuripv","followers_url":"https://api.github.com/users/yuripv/followers","following_url":"https://api.github.com/users/yuripv/following{/other_user}","gists_url":"https://api.github.com/users/yuripv/gists{/gist_id}","starred_url":"https://api.github.com/users/yuripv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuripv/subscriptions","organizations_url":"https://api.github.com/users/yuripv/orgs","repos_url":"https://api.github.com/users/yuripv/repos","events_url":"https://api.github.com/users/yuripv/events{/privacy}","received_events_url":"https://api.github.com/users/yuripv/received_events","type":"User","site_admin":false},"body":"Same as above.","created_at":"2017-02-05T17:54:27Z","updated_at":"2017-02-05T17:54:27Z","html_url":"https://github.com/openzfs/openzfs/pull/280#discussion_r99495176","pull_request_url":"https://api.github.com/repos/openzfs/openzfs/pulls/280","_links":{"self":{"href":"https://api.github.com/repos/openzfs/openzfs/pulls/comments/99495176"},"html":{"href":"https://github.com/openzfs/openzfs/pull/280#discussion_r99495176"},"pull_request":{"href":"https://api.github.com/repos/openzfs/openzfs/pulls/280"}}},"pull_request":{"url":"https://api.github.com/repos/openzfs/openzfs/pulls/280","id":101532560,"html_url":"https://github.com/openzfs/openzfs/pull/280","diff_url":"https://github.com/openzfs/openzfs/pull/280.diff","patch_url":"https://github.com/openzfs/openzfs/pull/280.patch","issue_url":"https://api.github.com/repos/openzfs/openzfs/issues/280","number":280,"state":"open","locked":false,"title":"6410 teach zdb to perform object lookups by path","user":{"login":"yuripv","id":1367473,"avatar_url":"https://avatars.githubusercontent.com/u/1367473?v=3","gravatar_id":"","url":"https://api.github.com/users/yuripv","html_url":"https://github.com/yuripv","followers_url":"https://api.github.com/users/yuripv/followers","following_url":"https://api.github.com/users/yuripv/following{/other_user}","gists_url":"https://api.github.com/users/yuripv/gists{/gist_id}","starred_url":"https://api.github.com/users/yuripv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuripv/subscriptions","organizations_url":"https://api.github.com/users/yuripv/orgs","repos_url":"https://api.github.com/users/yuripv/repos","events_url":"https://api.github.com/users/yuripv/events{/privacy}","received_events_url":"https://api.github.com/users/yuripv/received_events","type":"User","site_admin":false},"body":"Pickup the original work by @wca in #29 \r\n\r\nDifferences:\r\n- use -O instead of -o, which was already taken\r\n- simplify the syntax removing the \"file|directory\" object type selection, as it was no-op, and corresponding code\r\n\r\nThere are actually 2 commits, first one (done by me) is man page conversion and cleanup, as well as cleaning up the usage message in zdb itself - done as @wca's work did sort the options anyway.\r\n\r\n```\r\n$ zdb -h\r\nUsage:  zdb [-AbcdDFGhiLMPsvX] [-e [-p <path> ...]] [-I <inflight I/Os>]\r\n                [-o <var>=<value>]... [-t <txg>] [-U <cache>] [-x <dumpdir>]\r\n                [<poolname> [<object> ...]]\r\n        zdb [-AdiPv] [-e [-p <path> ...]] [-U <cache>] <dataset> [<object> ...]\r\n        zdb -C [-A] [-U <cache>]\r\n        zdb -l [-Aqu] <device>\r\n        zdb -m [-AFLMPX] [-e [-p <path> ...]] [-t <txg>] [-U <cache>]\r\n                <poolname> [<vdev> [<metaslab> ...]]\r\n        zdb -O <dataset> <path>\r\n        zdb -R [-A] [-e [-p <path> ...]] [-U <cache>]\r\n                <poolname> <vdev>:<offset>:<size>[:<flags>]\r\n        zdb -S [-AP] [-e [-p <path> ...]] [-U <cache>] <poolname>\r\n\r\n    Dataset name must include at least one separator character '/' or '@'\r\n    If dataset name is specified, only that dataset is dumped\r\n    If object numbers are specified, only those objects are dumped\r\n\r\n    Options to control amount of output:\r\n        -b block statistics\r\n        -c checksum all metadata (twice for all data) blocks\r\n        -C config (or cachefile if alone)\r\n        -d dataset(s)\r\n        -D dedup statistics\r\n        -h pool history\r\n        -i intent logs\r\n        -l read label contents\r\n        -L disable leak tracking (do not load spacemaps)\r\n        -m metaslabs\r\n        -M metaslab groups\r\n        -O perform object lookups by path\r\n        -R read and display block from a device\r\n        -s report stats on zdb's I/O\r\n        -S simulate dedup to measure effect\r\n        -v verbose (applies to all others)\r\n\r\n    Below options are intended for use with other options:\r\n        -A ignore assertions (-A), enable panic recovery (-AA) or both (-AAA)\r\n        -e pool is exported/destroyed/has altroot/not in a cachefile\r\n        -F attempt automatic rewind within safe range of transaction groups\r\n        -G dump zfs_dbgmsg buffer before exiting\r\n        -I <number of inflight I/Os> -- specify the maximum number of checksumming I/Os [default is 200]\r\n        -o <variable>=<value> set global variable to an unsigned 32-bit integer value\r\n        -p <path> -- use one or more with -e to specify path to vdev dir\r\n        -P print numbers in parseable form\r\n        -q don't print label contents\r\n        -t <txg> -- highest txg to use when searching for uberblocks\r\n        -u uberblock\r\n        -U <cachefile_path> -- use alternate cachefile\r\n        -x <dumpdir> -- dump all read blocks into specified directory\r\n        -X attempt extreme rewind (does not work with dataset)\r\n\r\nSpecify an option more than once (e.g. -bb) to make only that option verbose\r\nDefault is to dump everything non-verbosely\r\n```","created_at":"2017-01-13T23:02:47Z","updated_at":"2017-02-05T17:54:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4338177588378931a5c535d94eef847c6d38302a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openzfs/openzfs/pulls/280/commits","review_comments_url":"https://api.github.com/repos/openzfs/openzfs/pulls/280/comments","review_comment_url":"https://api.github.com/repos/openzfs/openzfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openzfs/openzfs/issues/280/comments","statuses_url":"https://api.github.com/repos/openzfs/openzfs/statuses/3c60ca23d22af50a517e0b42014ae23a5e32e949","head":{"label":"yuripv:il-6410","ref":"il-6410","sha":"3c60ca23d22af50a517e0b42014ae23a5e32e949","user":{"login":"yuripv","id":1367473,"avatar_url":"https://avatars.githubusercontent.com/u/1367473?v=3","gravatar_id":"","url":"https://api.github.com/users/yuripv","html_url":"https://github.com/yuripv","followers_url":"https://api.github.com/users/yuripv/followers","following_url":"https://api.github.com/users/yuripv/following{/other_user}","gists_url":"https://api.github.com/users/yuripv/gists{/gist_id}","starred_url":"https://api.github.com/users/yuripv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuripv/subscriptions","organizations_url":"https://api.github.com/users/yuripv/orgs","repos_url":"https://api.github.com/users/yuripv/repos","events_url":"https://api.github.com/users/yuripv/events{/privacy}","received_events_url":"https://api.github.com/users/yuripv/received_events","type":"User","site_admin":false},"repo":{"id":47791418,"name":"illumos-gate","full_name":"yuripv/illumos-gate","owner":{"login":"yuripv","id":1367473,"avatar_url":"https://avatars.githubusercontent.com/u/1367473?v=3","gravatar_id":"","url":"https://api.github.com/users/yuripv","html_url":"https://github.com/yuripv","followers_url":"https://api.github.com/users/yuripv/followers","following_url":"https://api.github.com/users/yuripv/following{/other_user}","gists_url":"https://api.github.com/users/yuripv/gists{/gist_id}","starred_url":"https://api.github.com/users/yuripv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuripv/subscriptions","organizations_url":"https://api.github.com/users/yuripv/orgs","repos_url":"https://api.github.com/users/yuripv/repos","events_url":"https://api.github.com/users/yuripv/events{/privacy}","received_events_url":"https://api.github.com/users/yuripv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yuripv/illumos-gate","description":"Community developed and maintained version of the OS/Net consolidation","fork":true,"url":"https://api.github.com/repos/yuripv/illumos-gate","forks_url":"https://api.github.com/repos/yuripv/illumos-gate/forks","keys_url":"https://api.github.com/repos/yuripv/illumos-gate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yuripv/illumos-gate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yuripv/illumos-gate/teams","hooks_url":"https://api.github.com/repos/yuripv/illumos-gate/hooks","issue_events_url":"https://api.github.com/repos/yuripv/illumos-gate/issues/events{/number}","events_url":"https://api.github.com/repos/yuripv/illumos-gate/events","assignees_url":"https://api.github.com/repos/yuripv/illumos-gate/assignees{/user}","branches_url":"https://api.github.com/repos/yuripv/illumos-gate/branches{/branch}","tags_url":"https://api.github.com/repos/yuripv/illumos-gate/tags","blobs_url":"https://api.github.com/repos/yuripv/illumos-gate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yuripv/illumos-gate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yuripv/illumos-gate/git/refs{/sha}","trees_url":"https://api.github.com/repos/yuripv/illumos-gate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yuripv/illumos-gate/statuses/{sha}","languages_url":"https://api.github.com/repos/yuripv/illumos-gate/languages","stargazers_url":"https://api.github.com/repos/yuripv/illumos-gate/stargazers","contributors_url":"https://api.github.com/repos/yuripv/illumos-gate/contributors","subscribers_url":"https://api.github.com/repos/yuripv/illumos-gate/subscribers","subscription_url":"https://api.github.com/repos/yuripv/illumos-gate/subscription","commits_url":"https://api.github.com/repos/yuripv/illumos-gate/commits{/sha}","git_commits_url":"https://api.github.com/repos/yuripv/illumos-gate/git/commits{/sha}","comments_url":"https://api.github.com/repos/yuripv/illumos-gate/comments{/number}","issue_comment_url":"https://api.github.com/repos/yuripv/illumos-gate/issues/comments{/number}","contents_url":"https://api.github.com/repos/yuripv/illumos-gate/contents/{+path}","compare_url":"https://api.github.com/repos/yuripv/illumos-gate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yuripv/illumos-gate/merges","archive_url":"https://api.github.com/repos/yuripv/illumos-gate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yuripv/illumos-gate/downloads","issues_url":"https://api.github.com/repos/yuripv/illumos-gate/issues{/number}","pulls_url":"https://api.github.com/repos/yuripv/illumos-gate/pulls{/number}","milestones_url":"https://api.github.com/repos/yuripv/illumos-gate/milestones{/number}","notifications_url":"https://api.github.com/repos/yuripv/illumos-gate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yuripv/illumos-gate/labels{/name}","releases_url":"https://api.github.com/repos/yuripv/illumos-gate/releases{/id}","deployments_url":"https://api.github.com/repos/yuripv/illumos-gate/deployments","created_at":"2015-12-10T22:36:34Z","updated_at":"2017-01-08T14:36:22Z","pushed_at":"2017-02-02T17:39:58Z","git_url":"git://github.com/yuripv/illumos-gate.git","ssh_url":"git@github.com:yuripv/illumos-gate.git","clone_url":"https://github.com/yuripv/illumos-gate.git","svn_url":"https://github.com/yuripv/illumos-gate","homepage":"http://www.illumos.org/projects/illumos-gate","size":270563,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openzfs:master","ref":"master","sha":"170f58e91a0076c7734c77b7bf740ce09eaf87dd","user":{"login":"openzfs","id":4510897,"avatar_url":"https://avatars.githubusercontent.com/u/4510897?v=3","gravatar_id":"","url":"https://api.github.com/users/openzfs","html_url":"https://github.com/openzfs","followers_url":"https://api.github.com/users/openzfs/followers","following_url":"https://api.github.com/users/openzfs/following{/other_user}","gists_url":"https://api.github.com/users/openzfs/gists{/gist_id}","starred_url":"https://api.github.com/users/openzfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openzfs/subscriptions","organizations_url":"https://api.github.com/users/openzfs/orgs","repos_url":"https://api.github.com/users/openzfs/repos","events_url":"https://api.github.com/users/openzfs/events{/privacy}","received_events_url":"https://api.github.com/users/openzfs/received_events","type":"Organization","site_admin":false},"repo":{"id":44220580,"name":"openzfs","full_name":"openzfs/openzfs","owner":{"login":"openzfs","id":4510897,"avatar_url":"https://avatars.githubusercontent.com/u/4510897?v=3","gravatar_id":"","url":"https://api.github.com/users/openzfs","html_url":"https://github.com/openzfs","followers_url":"https://api.github.com/users/openzfs/followers","following_url":"https://api.github.com/users/openzfs/following{/other_user}","gists_url":"https://api.github.com/users/openzfs/gists{/gist_id}","starred_url":"https://api.github.com/users/openzfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openzfs/subscriptions","organizations_url":"https://api.github.com/users/openzfs/orgs","repos_url":"https://api.github.com/users/openzfs/repos","events_url":"https://api.github.com/users/openzfs/events{/privacy}","received_events_url":"https://api.github.com/users/openzfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openzfs/openzfs","description":"OpenZFS is a storage platform that encompasses the functionality of traditional filesystems and volume managers, delivering enterprise reliability, modern functionality, and consistent performance in an easy to administer package on several operating system platforms.","fork":true,"url":"https://api.github.com/repos/openzfs/openzfs","forks_url":"https://api.github.com/repos/openzfs/openzfs/forks","keys_url":"https://api.github.com/repos/openzfs/openzfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openzfs/openzfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openzfs/openzfs/teams","hooks_url":"https://api.github.com/repos/openzfs/openzfs/hooks","issue_events_url":"https://api.github.com/repos/openzfs/openzfs/issues/events{/number}","events_url":"https://api.github.com/repos/openzfs/openzfs/events","assignees_url":"https://api.github.com/repos/openzfs/openzfs/assignees{/user}","branches_url":"https://api.github.com/repos/openzfs/openzfs/branches{/branch}","tags_url":"https://api.github.com/repos/openzfs/openzfs/tags","blobs_url":"https://api.github.com/repos/openzfs/openzfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openzfs/openzfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openzfs/openzfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/openzfs/openzfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openzfs/openzfs/statuses/{sha}","languages_url":"https://api.github.com/repos/openzfs/openzfs/languages","stargazers_url":"https://api.github.com/repos/openzfs/openzfs/stargazers","contributors_url":"https://api.github.com/repos/openzfs/openzfs/contributors","subscribers_url":"https://api.github.com/repos/openzfs/openzfs/subscribers","subscription_url":"https://api.github.com/repos/openzfs/openzfs/subscription","commits_url":"https://api.github.com/repos/openzfs/openzfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/openzfs/openzfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/openzfs/openzfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/openzfs/openzfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/openzfs/openzfs/contents/{+path}","compare_url":"https://api.github.com/repos/openzfs/openzfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openzfs/openzfs/merges","archive_url":"https://api.github.com/repos/openzfs/openzfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openzfs/openzfs/downloads","issues_url":"https://api.github.com/repos/openzfs/openzfs/issues{/number}","pulls_url":"https://api.github.com/repos/openzfs/openzfs/pulls{/number}","milestones_url":"https://api.github.com/repos/openzfs/openzfs/milestones{/number}","notifications_url":"https://api.github.com/repos/openzfs/openzfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openzfs/openzfs/labels{/name}","releases_url":"https://api.github.com/repos/openzfs/openzfs/releases{/id}","deployments_url":"https://api.github.com/repos/openzfs/openzfs/deployments","created_at":"2015-10-14T03:03:50Z","updated_at":"2017-01-29T14:09:22Z","pushed_at":"2017-02-02T17:40:00Z","git_url":"git://github.com/openzfs/openzfs.git","ssh_url":"git@github.com:openzfs/openzfs.git","clone_url":"https://github.com/openzfs/openzfs.git","svn_url":"https://github.com/openzfs/openzfs","homepage":"http://open-zfs.org","size":270550,"stargazers_count":113,"watchers_count":113,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":38,"forks":38,"open_issues":38,"watchers":113,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openzfs/openzfs/pulls/280"},"html":{"href":"https://github.com/openzfs/openzfs/pull/280"},"issue":{"href":"https://api.github.com/repos/openzfs/openzfs/issues/280"},"comments":{"href":"https://api.github.com/repos/openzfs/openzfs/issues/280/comments"},"review_comments":{"href":"https://api.github.com/repos/openzfs/openzfs/pulls/280/comments"},"review_comment":{"href":"https://api.github.com/repos/openzfs/openzfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openzfs/openzfs/pulls/280/commits"},"statuses":{"href":"https://api.github.com/repos/openzfs/openzfs/statuses/3c60ca23d22af50a517e0b42014ae23a5e32e949"}}}}
{"actor":{"display_login":"yuripv"}}