{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/46756401","id":46756401,"diff_hunk":"@@ -1945,7 +1945,8 @@ int buffer::list::write_fd(int fd) const\n     return write_fd_zero_copy(fd);\n \n   // use writev!\n-  iovec iov[IOV_MAX];\n+  int max = MIN(_buffers.size(), IOV_MAX);","path":"src/common/buffer.cc","position":5,"original_position":5,"commit_id":"e28642d2f0eb13625b00f1d041e56e1df45113f9","original_commit_id":"e28642d2f0eb13625b00f1d041e56e1df45113f9","user":{"login":"dachary","id":433594,"avatar_url":"https://avatars.githubusercontent.com/u/433594?v=3","gravatar_id":"","url":"https://api.github.com/users/dachary","html_url":"https://github.com/dachary","followers_url":"https://api.github.com/users/dachary/followers","following_url":"https://api.github.com/users/dachary/following{/other_user}","gists_url":"https://api.github.com/users/dachary/gists{/gist_id}","starred_url":"https://api.github.com/users/dachary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dachary/subscriptions","organizations_url":"https://api.github.com/users/dachary/orgs","repos_url":"https://api.github.com/users/dachary/repos","events_url":"https://api.github.com/users/dachary/events{/privacy}","received_events_url":"https://api.github.com/users/dachary/received_events","type":"User","site_admin":false},"body":"shouldn't we **assert(_buffers.size() <= IOV_MAX)** here instead ? It looks like the code below will overflow the array otherwise.","created_at":"2015-12-05T09:28:45Z","updated_at":"2015-12-05T09:28:45Z","html_url":"https://github.com/ceph/ceph/pull/6806#discussion_r46756401","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/6806","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/46756401"},"html":{"href":"https://github.com/ceph/ceph/pull/6806#discussion_r46756401"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/6806"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/6806","id":52743272,"html_url":"https://github.com/ceph/ceph/pull/6806","diff_url":"https://github.com/ceph/ceph/pull/6806.diff","patch_url":"https://github.com/ceph/ceph/pull/6806.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/6806","number":6806,"state":"open","locked":false,"title":"common/buffer.cc: allocate iov on demand in write_fd","user":{"login":"mikulely","id":4464227,"avatar_url":"https://avatars.githubusercontent.com/u/4464227?v=3","gravatar_id":"","url":"https://api.github.com/users/mikulely","html_url":"https://github.com/mikulely","followers_url":"https://api.github.com/users/mikulely/followers","following_url":"https://api.github.com/users/mikulely/following{/other_user}","gists_url":"https://api.github.com/users/mikulely/gists{/gist_id}","starred_url":"https://api.github.com/users/mikulely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikulely/subscriptions","organizations_url":"https://api.github.com/users/mikulely/orgs","repos_url":"https://api.github.com/users/mikulely/repos","events_url":"https://api.github.com/users/mikulely/events{/privacy}","received_events_url":"https://api.github.com/users/mikulely/received_events","type":"User","site_admin":false},"body":"Current `write_fd` implementation allocates iov arrary in fixed\r\nsize(`IOV_MAX`),that's memory inefficient for writev syscall.\r\n\r\nCause `writev` syscall's behavior depends on iov arrary's size.\r\nIf the iov arrary's size is smaller than `UIO_FASTIOV`(defined in\r\n`include/uapi/linux/uio.h`),kernel allocates segments on its\r\nstack,vectored-IO occurs in a very memory-efficient manner.\r\n\r\nThis commit allows allocating iov array size on demand,and let the\r\nkernel optimize `writev` syscall.\r\n\r\nSigned-off-by: Jiaying Ren <mikulely@gmail.com>","created_at":"2015-12-05T01:55:55Z","updated_at":"2015-12-05T09:28:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c52e72a4e2d769800fda71c2fe37eafcf1cbedd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/6806/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/6806/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/6806/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/e28642d2f0eb13625b00f1d041e56e1df45113f9","head":{"label":"mikulely:master","ref":"master","sha":"e28642d2f0eb13625b00f1d041e56e1df45113f9","user":{"login":"mikulely","id":4464227,"avatar_url":"https://avatars.githubusercontent.com/u/4464227?v=3","gravatar_id":"","url":"https://api.github.com/users/mikulely","html_url":"https://github.com/mikulely","followers_url":"https://api.github.com/users/mikulely/followers","following_url":"https://api.github.com/users/mikulely/following{/other_user}","gists_url":"https://api.github.com/users/mikulely/gists{/gist_id}","starred_url":"https://api.github.com/users/mikulely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikulely/subscriptions","organizations_url":"https://api.github.com/users/mikulely/orgs","repos_url":"https://api.github.com/users/mikulely/repos","events_url":"https://api.github.com/users/mikulely/events{/privacy}","received_events_url":"https://api.github.com/users/mikulely/received_events","type":"User","site_admin":false},"repo":{"id":47048129,"name":"ceph","full_name":"mikulely/ceph","owner":{"login":"mikulely","id":4464227,"avatar_url":"https://avatars.githubusercontent.com/u/4464227?v=3","gravatar_id":"","url":"https://api.github.com/users/mikulely","html_url":"https://github.com/mikulely","followers_url":"https://api.github.com/users/mikulely/followers","following_url":"https://api.github.com/users/mikulely/following{/other_user}","gists_url":"https://api.github.com/users/mikulely/gists{/gist_id}","starred_url":"https://api.github.com/users/mikulely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikulely/subscriptions","organizations_url":"https://api.github.com/users/mikulely/orgs","repos_url":"https://api.github.com/users/mikulely/repos","events_url":"https://api.github.com/users/mikulely/events{/privacy}","received_events_url":"https://api.github.com/users/mikulely/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mikulely/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":true,"url":"https://api.github.com/repos/mikulely/ceph","forks_url":"https://api.github.com/repos/mikulely/ceph/forks","keys_url":"https://api.github.com/repos/mikulely/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikulely/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikulely/ceph/teams","hooks_url":"https://api.github.com/repos/mikulely/ceph/hooks","issue_events_url":"https://api.github.com/repos/mikulely/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/mikulely/ceph/events","assignees_url":"https://api.github.com/repos/mikulely/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/mikulely/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/mikulely/ceph/tags","blobs_url":"https://api.github.com/repos/mikulely/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikulely/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikulely/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikulely/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikulely/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/mikulely/ceph/languages","stargazers_url":"https://api.github.com/repos/mikulely/ceph/stargazers","contributors_url":"https://api.github.com/repos/mikulely/ceph/contributors","subscribers_url":"https://api.github.com/repos/mikulely/ceph/subscribers","subscription_url":"https://api.github.com/repos/mikulely/ceph/subscription","commits_url":"https://api.github.com/repos/mikulely/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikulely/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikulely/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikulely/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikulely/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/mikulely/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikulely/ceph/merges","archive_url":"https://api.github.com/repos/mikulely/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikulely/ceph/downloads","issues_url":"https://api.github.com/repos/mikulely/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/mikulely/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/mikulely/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/mikulely/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikulely/ceph/labels{/name}","releases_url":"https://api.github.com/repos/mikulely/ceph/releases{/id}","created_at":"2015-11-29T03:15:50Z","updated_at":"2015-11-29T03:16:27Z","pushed_at":"2015-12-05T01:53:42Z","git_url":"git://github.com/mikulely/ceph.git","ssh_url":"git@github.com:mikulely/ceph.git","clone_url":"https://github.com/mikulely/ceph.git","svn_url":"https://github.com/mikulely/ceph","homepage":"http://ceph.com","size":146268,"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":"ceph:master","ref":"master","sha":"b0997bc5aa205c064da92ca0951c781965c437d7","user":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"repo":{"id":2310495,"name":"ceph","full_name":"ceph/ceph","owner":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ceph/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":false,"url":"https://api.github.com/repos/ceph/ceph","forks_url":"https://api.github.com/repos/ceph/ceph/forks","keys_url":"https://api.github.com/repos/ceph/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceph/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceph/ceph/teams","hooks_url":"https://api.github.com/repos/ceph/ceph/hooks","issue_events_url":"https://api.github.com/repos/ceph/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/ceph/ceph/events","assignees_url":"https://api.github.com/repos/ceph/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/ceph/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/ceph/ceph/tags","blobs_url":"https://api.github.com/repos/ceph/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceph/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceph/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceph/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/ceph/ceph/languages","stargazers_url":"https://api.github.com/repos/ceph/ceph/stargazers","contributors_url":"https://api.github.com/repos/ceph/ceph/contributors","subscribers_url":"https://api.github.com/repos/ceph/ceph/subscribers","subscription_url":"https://api.github.com/repos/ceph/ceph/subscription","commits_url":"https://api.github.com/repos/ceph/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceph/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceph/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceph/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceph/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/ceph/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceph/ceph/merges","archive_url":"https://api.github.com/repos/ceph/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceph/ceph/downloads","issues_url":"https://api.github.com/repos/ceph/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/ceph/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/ceph/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/ceph/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceph/ceph/labels{/name}","releases_url":"https://api.github.com/repos/ceph/ceph/releases{/id}","created_at":"2011-09-01T21:41:26Z","updated_at":"2015-12-05T02:10:53Z","pushed_at":"2015-12-05T08:00:06Z","git_url":"git://github.com/ceph/ceph.git","ssh_url":"git@github.com:ceph/ceph.git","clone_url":"https://github.com/ceph/ceph.git","svn_url":"https://github.com/ceph/ceph","homepage":"http://ceph.com","size":170466,"stargazers_count":1703,"watchers_count":1703,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1014,"mirror_url":null,"open_issues_count":235,"forks":1014,"open_issues":235,"watchers":1703,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/6806"},"html":{"href":"https://github.com/ceph/ceph/pull/6806"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/6806"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/6806/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/6806/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/6806/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/e28642d2f0eb13625b00f1d041e56e1df45113f9"}}}}