{"thread":{"id":"46774","subject":"[PATCH] pack: make packed_git_mru global a value instead of a pointer","startedAt":"2017-09-17T20:18:07Z","lastAt":"2017-09-18T17:26:13Z","messageCount":4,"participants":["phionah bugosi","Christian Couder","Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"328269","messageId":"1505679467-20720-1-git-send-email-bugosip@gmail.com","threadId":"46774","inReplyTo":null,"subject":"[PATCH] pack: make packed_git_mru global a value instead of a pointer","fromName":"phionah bugosi","fromEmail":"bugosip@gmail.com","sentAt":"2017-09-17T20:17:47Z","receivedAt":"2017-09-17T20:18:07Z","isPatch":true,"sender":{"key":"bugosip@gmail.com","avatar":null},"body":"Signed-off-by: phionah bugosi <bugosip@gmail.com>\n---\n builtin/pack-objects.c |  5 +++--\n cache.h                |  7 -------\n list.h                 |  6 ++++++\n packfile.c             | 12 ++++++------\n 4 files changed, 15 insertions(+), 15 deletions(-)\n\nThis patch makes packed_git_mru global a value instead of a pointer and\nmakes use of list.h\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex a57b4f0..189123f 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"list.h\"\n #include \"config.h\"\n #include \"attr.h\"\n #include \"object.h\"\n@@ -1012,7 +1013,7 @@ static int want_object_in_pack(const unsigned char *sha1,\n \t\t\treturn want;\n \t}\n \n-\tfor (entry = packed_git_mru->head; entry; entry = entry->next) {\n+\tfor (entry = packed_git_mru.head; entry; entry = entry->next) {\n \t\tstruct packed_git *p = entry->item;\n \t\toff_t offset;\n \n@@ -1030,7 +1031,7 @@ static int want_object_in_pack(const unsigned char *sha1,\n \t\t\t}\n \t\t\twant = want_found_object(exclude, p);\n \t\t\tif (!exclude && want > 0)\n-\t\t\t\tmru_mark(packed_git_mru, entry);\n+\t\t\t\tmru_mark(&packed_git_mru, entry);\n \t\t\tif (want != -1)\n \t\t\t\treturn want;\n \t\t}\ndiff --git a/cache.h b/cache.h\nindex a916bc7..c8d7086 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1585,13 +1585,6 @@ extern struct packed_git {\n \tchar pack_name[FLEX_ARRAY]; /* more */\n } *packed_git;\n \n-/*\n- * A most-recently-used ordered version of the packed_git list, which can\n- * be iterated instead of packed_git (and marked via mru_mark).\n- */\n-struct mru;\n-extern struct mru *packed_git_mru;\n-\n struct pack_entry {\n \toff_t offset;\n \tunsigned char sha1[20];\ndiff --git a/list.h b/list.h\nindex a226a87..525703b 100644\n--- a/list.h\n+++ b/list.h\n@@ -26,6 +26,12 @@\n #define LIST_H\t1\n \n /*\n+ * A most-recently-used ordered version of the packed_git list, which can\n+ * be iterated instead of packed_git (and marked via mru_mark).\n+ */\n+extern struct mru packed_git_mru\n+\n+/*\n  * The definitions of this file are adopted from those which can be\n  * found in the Linux kernel headers to enable people familiar with the\n  * latter find their way in these sources as well.\ndiff --git a/packfile.c b/packfile.c\nindex f86fa05..61a61aa 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"list.h\"\n #include \"mru.h\"\n #include \"pack.h\"\n #include \"dir.h\"\n@@ -41,8 +42,7 @@ static size_t peak_pack_mapped;\n static size_t pack_mapped;\n struct packed_git *packed_git;\n \n-static struct mru packed_git_mru_storage;\n-struct mru *packed_git_mru = &packed_git_mru_storage;\n+struct mru packed_git_mru;\n \n #define SZ_FMT PRIuMAX\n static inline uintmax_t sz_fmt(size_t s) { return s; }\n@@ -861,9 +861,9 @@ static void prepare_packed_git_mru(void)\n {\n \tstruct packed_git *p;\n \n-\tmru_clear(packed_git_mru);\n+\tmru_clear(&packed_git_mru);\n \tfor (p = packed_git; p; p = p->next)\n-\t\tmru_append(packed_git_mru, p);\n+\t\tmru_append(&packed_git_mru, p);\n }\n \n static int prepare_packed_git_run_once = 0;\n@@ -1832,9 +1832,9 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)\n \tif (!packed_git)\n \t\treturn 0;\n \n-\tfor (p = packed_git_mru->head; p; p = p->next) {\n+\tfor (p = packed_git_mru.head; p; p = p->next) {\n \t\tif (fill_pack_entry(sha1, e, p->item)) {\n-\t\t\tmru_mark(packed_git_mru, p);\n+\t\t\tmru_mark(&packed_git_mru, p);\n \t\t\treturn 1;\n \t\t}\n \t}\n-- \n2.7.4\n\n"},{"id":"328271","messageId":"CAP8UFD2f3jXkRHb_S_dK7TDfhBwXQ+O63cBn0J7iQQA-5ysVMQ@mail.gmail.com","threadId":"46774","inReplyTo":"1505679467-20720-1-git-send-email-bugosip@gmail.com","subject":"Re: [PATCH] pack: make packed_git_mru global a value instead of a pointer","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-09-17T20:42:31Z","receivedAt":"2017-09-17T20:42:39Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Sep 17, 2017 at 10:17 PM, phionah bugosi <bugosip@gmail.com> wrote:\n> Signed-off-by: phionah bugosi <bugosip@gmail.com>\n> ---\n>  builtin/pack-objects.c |  5 +++--\n>  cache.h                |  7 -------\n>  list.h                 |  6 ++++++\n>  packfile.c             | 12 ++++++------\n>  4 files changed, 15 insertions(+), 15 deletions(-)\n>\n> This patch makes packed_git_mru global a value instead of a pointer and\n> makes use of list.h\n\nPlease explain _why_ you are doing that (why is the resulting code better).\n\nYou may also add [Outreachy] in the patch subject to tell people that\nyou are applying for the Outreachy round 15 program\n(https://git.github.io/Outreachy-15/).\n\nThanks!\n"},{"id":"328272","messageId":"CAP8UFD2d7y9COGj=bRLk_d+F_M=c7nv802AjBf=R9NnJQB7ohA@mail.gmail.com","threadId":"46774","inReplyTo":"CAP8UFD2f3jXkRHb_S_dK7TDfhBwXQ+O63cBn0J7iQQA-5ysVMQ@mail.gmail.com","subject":"Re: [PATCH] pack: make packed_git_mru global a value instead of a pointer","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-09-17T20:44:53Z","receivedAt":"2017-09-17T20:45:04Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Sep 17, 2017 at 10:42 PM, Christian Couder\n<christian.couder@gmail.com> wrote:\n> On Sun, Sep 17, 2017 at 10:17 PM, phionah bugosi <bugosip@gmail.com> wrote:\n>> Signed-off-by: phionah bugosi <bugosip@gmail.com>\n>> ---\n>>  builtin/pack-objects.c |  5 +++--\n>>  cache.h                |  7 -------\n>>  list.h                 |  6 ++++++\n>>  packfile.c             | 12 ++++++------\n>>  4 files changed, 15 insertions(+), 15 deletions(-)\n>>\n>> This patch makes packed_git_mru global a value instead of a pointer and\n>> makes use of list.h\n>\n> Please explain _why_ you are doing that (why is the resulting code better).\n\nAlso the explanations should be in the commit message, that is above\nyour \"Signed-off-by: ...\" line.\n"},{"id":"328313","messageId":"CAGZ79kZwt5zM1N1=418FHMLZPjMJV55kKbJoat6GT157dxZObA@mail.gmail.com","threadId":"46774","inReplyTo":"CAP8UFD2d7y9COGj=bRLk_d+F_M=c7nv802AjBf=R9NnJQB7ohA@mail.gmail.com","subject":"Re: [PATCH] pack: make packed_git_mru global a value instead of a pointer","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-09-18T17:26:07Z","receivedAt":"2017-09-18T17:26:13Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Sun, Sep 17, 2017 at 1:44 PM, Christian Couder\n<christian.couder@gmail.com> wrote:\n> On Sun, Sep 17, 2017 at 10:42 PM, Christian Couder\n> <christian.couder@gmail.com> wrote:\n>> On Sun, Sep 17, 2017 at 10:17 PM, phionah bugosi <bugosip@gmail.com> wrote:\n>>> Signed-off-by: phionah bugosi <bugosip@gmail.com>\n>>> ---\n>>>  builtin/pack-objects.c |  5 +++--\n>>>  cache.h                |  7 -------\n>>>  list.h                 |  6 ++++++\n>>>  packfile.c             | 12 ++++++------\n>>>  4 files changed, 15 insertions(+), 15 deletions(-)\n>>>\n>>> This patch makes packed_git_mru global a value instead of a pointer and\n>>> makes use of list.h\n>>\n>> Please explain _why_ you are doing that (why is the resulting code better).\n>\n> Also the explanations should be in the commit message, that is above\n> your \"Signed-off-by: ...\" line.\n\nA similar patch exists at origin/jn/per-repo-object-store-fixes^^\n(I haven't checked if there are differences and if so which\npatch is better, all I am noting here, is that there has been\nwork very similar to this one a couple days prior)\n"}]}