{"action":"created","comment":{"url":"https://api.github.com/repos/keybase/kbfs/pulls/comments/105513222","pull_request_review_id":26403149,"id":105513222,"diff_hunk":"@@ -470,6 +479,49 @@ func (bdl *backpressureDiskLimiter) onBlocksDelete(\n \tbdl.fileTracker.onBlocksDelete(blockFiles)\n }\n \n+func (bdl *backpressureDiskLimiter) onDiskBlockCacheDelete(\n+\tctx context.Context, blockBytes int64) {\n+\tif blockBytes == 0 {\n+\t\treturn\n+\t}\n+\tbdl.lock.Lock()\n+\tdefer bdl.lock.Unlock()\n+\tbdl.byteTracker.onBlocksDelete(blockBytes)\n+}\n+\n+func (bdl *backpressureDiskLimiter) beforeDiskBlockCachePut(\n+\tctx context.Context, blockBytes, diskBlockCacheBytes int64) (\n+\tavailableBytes int64, err error) {\n+\tif blockBytes == 0 {\n+\t\t// Better to return an error than to panic in Acquire.\n+\t\treturn 0, errors.New(\"backpressureDiskLimiter.beforeDiskBlockCachePut\" +\n+\t\t\t\" called with 0 blockBytes\")\n+\t}\n+\tbdl.lock.Lock()\n+\tdefer bdl.lock.Unlock()\n+\tfreeBytes, freeFiles, err := bdl.freeBytesAndFilesFn()\n+\tif err != nil {\n+\t\treturn\n+\t}\n+\tbdl.byteTracker.updateFree(freeBytes)\n+\tbdl.fileTracker.updateFree(freeFiles)\n+\n+\tdiskBlockCacheLimit := int64(bdl.byteTracker.currLimit() *\n+\t\tbdl.byteTracker.minThreshold * diskBlockCacheFrac)\n+\tif diskBlockCacheLimit < diskBlockCacheBytes+blockBytes {\n+\t\t// The overall disk block cache limit has been exceeded.  Return a\n+\t\t// negative result so the block cache knows how much it must evict\n+\t\t// before retrying.\n+\t\treturn diskBlockCacheLimit - (diskBlockCacheBytes + blockBytes),\n+\t\t\terrors.New(\"backpressureDiskLimiter needs more space\")\n+\t}\n+\t// The disk block cache is using up less than diskBlockCacheLimit bytes, so","path":"libkbfs/backpressure_disk_limiter.go","position":72,"original_position":72,"commit_id":"76d6b402d8e46ac3248a3bc87408310352a00151","original_commit_id":"b15b05f6000af3e09342cda50b40ff145a5524e8","user":{"login":"akalin-keybase","id":13270622,"avatar_url":"https://avatars0.githubusercontent.com/u/13270622?v=3","gravatar_id":"","url":"https://api.github.com/users/akalin-keybase","html_url":"https://github.com/akalin-keybase","followers_url":"https://api.github.com/users/akalin-keybase/followers","following_url":"https://api.github.com/users/akalin-keybase/following{/other_user}","gists_url":"https://api.github.com/users/akalin-keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/akalin-keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akalin-keybase/subscriptions","organizations_url":"https://api.github.com/users/akalin-keybase/orgs","repos_url":"https://api.github.com/users/akalin-keybase/repos","events_url":"https://api.github.com/users/akalin-keybase/events{/privacy}","received_events_url":"https://api.github.com/users/akalin-keybase/received_events","type":"User","site_admin":false},"body":"Going negative is currently an edge case (e.g. if a journal gets enabled while we're putting lots of blocks) so I'm just a bit troubled by introducing another way for it to happen.\r\n\r\nWhat do you mean by this \"keeping with the purpose of the disk limiter\"?","created_at":"2017-03-10T23:57:29Z","updated_at":"2017-03-10T23:57:29Z","html_url":"https://github.com/keybase/kbfs/pull/836#discussion_r105513222","pull_request_url":"https://api.github.com/repos/keybase/kbfs/pulls/836","_links":{"self":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/comments/105513222"},"html":{"href":"https://github.com/keybase/kbfs/pull/836#discussion_r105513222"},"pull_request":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/836"}}},"pull_request":{"url":"https://api.github.com/repos/keybase/kbfs/pulls/836","id":109825061,"html_url":"https://github.com/keybase/kbfs/pull/836","diff_url":"https://github.com/keybase/kbfs/pull/836.diff","patch_url":"https://github.com/keybase/kbfs/pull/836.patch","issue_url":"https://api.github.com/repos/keybase/kbfs/issues/836","number":836,"state":"open","locked":false,"title":"[WIP KBFS-1920] Disk Cache Limiter","user":{"login":"jzila","id":59594,"avatar_url":"https://avatars2.githubusercontent.com/u/59594?v=3","gravatar_id":"","url":"https://api.github.com/users/jzila","html_url":"https://github.com/jzila","followers_url":"https://api.github.com/users/jzila/followers","following_url":"https://api.github.com/users/jzila/following{/other_user}","gists_url":"https://api.github.com/users/jzila/gists{/gist_id}","starred_url":"https://api.github.com/users/jzila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzila/subscriptions","organizations_url":"https://api.github.com/users/jzila/orgs","repos_url":"https://api.github.com/users/jzila/repos","events_url":"https://api.github.com/users/jzila/events{/privacy}","received_events_url":"https://api.github.com/users/jzila/received_events","type":"User","site_admin":false},"body":"This PR adds the ability for the journal's `diskLimiter` to also work with the `DiskBlockCacheStandard`. The limit function is as follows:\r\n\r\n* min(50GB, 0.25 * free space on drive) * 0.5 for the minimum backpressure threshold * 0.5 for the disk block cache limit.\r\n\r\nThis means that the maximum disk block cache size is 12.5GB, but in practice will only be that large when the user has >=200GB available on the drive where the journal is stored.\r\n\r\nTODO: Enable the disk cache by default for admin builds, which should include moving out the admin user array.\r\n\r\nFailure is `go vet`, will fix.","created_at":"2017-03-09T01:55:25Z","updated_at":"2017-03-10T23:57:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a294feb40bcc11ad9dd4dd7e9d866c52b28c85f2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/keybase/kbfs/pulls/836/commits","review_comments_url":"https://api.github.com/repos/keybase/kbfs/pulls/836/comments","review_comment_url":"https://api.github.com/repos/keybase/kbfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/keybase/kbfs/issues/836/comments","statuses_url":"https://api.github.com/repos/keybase/kbfs/statuses/76d6b402d8e46ac3248a3bc87408310352a00151","head":{"label":"keybase:jzila/KBFS-1920-disk-cache-limiter","ref":"jzila/KBFS-1920-disk-cache-limiter","sha":"76d6b402d8e46ac3248a3bc87408310352a00151","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars1.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":59787605,"name":"kbfs","full_name":"keybase/kbfs","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars1.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/kbfs","description":"Keybase Filesystem (KBFS)","fork":false,"url":"https://api.github.com/repos/keybase/kbfs","forks_url":"https://api.github.com/repos/keybase/kbfs/forks","keys_url":"https://api.github.com/repos/keybase/kbfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/kbfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/kbfs/teams","hooks_url":"https://api.github.com/repos/keybase/kbfs/hooks","issue_events_url":"https://api.github.com/repos/keybase/kbfs/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/kbfs/events","assignees_url":"https://api.github.com/repos/keybase/kbfs/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/kbfs/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/kbfs/tags","blobs_url":"https://api.github.com/repos/keybase/kbfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/kbfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/kbfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/kbfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/kbfs/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/kbfs/languages","stargazers_url":"https://api.github.com/repos/keybase/kbfs/stargazers","contributors_url":"https://api.github.com/repos/keybase/kbfs/contributors","subscribers_url":"https://api.github.com/repos/keybase/kbfs/subscribers","subscription_url":"https://api.github.com/repos/keybase/kbfs/subscription","commits_url":"https://api.github.com/repos/keybase/kbfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/kbfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/kbfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/kbfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/kbfs/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/kbfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/kbfs/merges","archive_url":"https://api.github.com/repos/keybase/kbfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/kbfs/downloads","issues_url":"https://api.github.com/repos/keybase/kbfs/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/kbfs/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/kbfs/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/kbfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/kbfs/labels{/name}","releases_url":"https://api.github.com/repos/keybase/kbfs/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/kbfs/deployments","created_at":"2016-05-26T22:37:42Z","updated_at":"2017-03-10T21:46:23Z","pushed_at":"2017-03-10T23:33:20Z","git_url":"git://github.com/keybase/kbfs.git","ssh_url":"git@github.com:keybase/kbfs.git","clone_url":"https://github.com/keybase/kbfs.git","svn_url":"https://github.com/keybase/kbfs","homepage":"https://keybase.io/docs/kbfs","size":52656,"stargazers_count":399,"watchers_count":399,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":31,"forks":42,"open_issues":31,"watchers":399,"default_branch":"master"}},"base":{"label":"keybase:KBFS-1845-disk-caching","ref":"KBFS-1845-disk-caching","sha":"75431b08e8e5902e1ae31162a45a6e5c1c8b57b9","user":{"login":"keybase","id":5400834,"avatar_url":"https://avatars1.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"repo":{"id":59787605,"name":"kbfs","full_name":"keybase/kbfs","owner":{"login":"keybase","id":5400834,"avatar_url":"https://avatars1.githubusercontent.com/u/5400834?v=3","gravatar_id":"","url":"https://api.github.com/users/keybase","html_url":"https://github.com/keybase","followers_url":"https://api.github.com/users/keybase/followers","following_url":"https://api.github.com/users/keybase/following{/other_user}","gists_url":"https://api.github.com/users/keybase/gists{/gist_id}","starred_url":"https://api.github.com/users/keybase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keybase/subscriptions","organizations_url":"https://api.github.com/users/keybase/orgs","repos_url":"https://api.github.com/users/keybase/repos","events_url":"https://api.github.com/users/keybase/events{/privacy}","received_events_url":"https://api.github.com/users/keybase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/keybase/kbfs","description":"Keybase Filesystem (KBFS)","fork":false,"url":"https://api.github.com/repos/keybase/kbfs","forks_url":"https://api.github.com/repos/keybase/kbfs/forks","keys_url":"https://api.github.com/repos/keybase/kbfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keybase/kbfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keybase/kbfs/teams","hooks_url":"https://api.github.com/repos/keybase/kbfs/hooks","issue_events_url":"https://api.github.com/repos/keybase/kbfs/issues/events{/number}","events_url":"https://api.github.com/repos/keybase/kbfs/events","assignees_url":"https://api.github.com/repos/keybase/kbfs/assignees{/user}","branches_url":"https://api.github.com/repos/keybase/kbfs/branches{/branch}","tags_url":"https://api.github.com/repos/keybase/kbfs/tags","blobs_url":"https://api.github.com/repos/keybase/kbfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keybase/kbfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keybase/kbfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/keybase/kbfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keybase/kbfs/statuses/{sha}","languages_url":"https://api.github.com/repos/keybase/kbfs/languages","stargazers_url":"https://api.github.com/repos/keybase/kbfs/stargazers","contributors_url":"https://api.github.com/repos/keybase/kbfs/contributors","subscribers_url":"https://api.github.com/repos/keybase/kbfs/subscribers","subscription_url":"https://api.github.com/repos/keybase/kbfs/subscription","commits_url":"https://api.github.com/repos/keybase/kbfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/keybase/kbfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/keybase/kbfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/keybase/kbfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/keybase/kbfs/contents/{+path}","compare_url":"https://api.github.com/repos/keybase/kbfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keybase/kbfs/merges","archive_url":"https://api.github.com/repos/keybase/kbfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keybase/kbfs/downloads","issues_url":"https://api.github.com/repos/keybase/kbfs/issues{/number}","pulls_url":"https://api.github.com/repos/keybase/kbfs/pulls{/number}","milestones_url":"https://api.github.com/repos/keybase/kbfs/milestones{/number}","notifications_url":"https://api.github.com/repos/keybase/kbfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keybase/kbfs/labels{/name}","releases_url":"https://api.github.com/repos/keybase/kbfs/releases{/id}","deployments_url":"https://api.github.com/repos/keybase/kbfs/deployments","created_at":"2016-05-26T22:37:42Z","updated_at":"2017-03-10T21:46:23Z","pushed_at":"2017-03-10T23:33:20Z","git_url":"git://github.com/keybase/kbfs.git","ssh_url":"git@github.com:keybase/kbfs.git","clone_url":"https://github.com/keybase/kbfs.git","svn_url":"https://github.com/keybase/kbfs","homepage":"https://keybase.io/docs/kbfs","size":52656,"stargazers_count":399,"watchers_count":399,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":31,"forks":42,"open_issues":31,"watchers":399,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/836"},"html":{"href":"https://github.com/keybase/kbfs/pull/836"},"issue":{"href":"https://api.github.com/repos/keybase/kbfs/issues/836"},"comments":{"href":"https://api.github.com/repos/keybase/kbfs/issues/836/comments"},"review_comments":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/836/comments"},"review_comment":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/keybase/kbfs/pulls/836/commits"},"statuses":{"href":"https://api.github.com/repos/keybase/kbfs/statuses/76d6b402d8e46ac3248a3bc87408310352a00151"}}}}
{"actor":{"display_login":"akalin-keybase"}}