From: Panu Matilainen Date: Fri, 17 Aug 2012 11:07:05 +0000 (+0300) Subject: Only create the first instance of a file shared between packages X-Git-Tag: rpm-4.11.0-alpha~261 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7f5f88f9f3d6587e747b034ccb64a3f00ff4e1e;p=platform%2Fupstream%2Frpm.git Only create the first instance of a file shared between packages - When packages share an identical file, we only need to create the first one we encounter and skip it for the rest (reverse already happens, and must happen, on erase). This has the benefit of getting the timestamp to match the first file, which often is also the last one to get removed. Also when lots of shared files are involved (such as in multilib installations), this can give several percents worth of speed gain as we dont unnecessarily rewrite the same contents over and over. --- diff --git a/lib/transaction.c b/lib/transaction.c index 9a7e4a2..74ecc49 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -500,6 +500,12 @@ assert(otherFi != NULL); rpmteNEVRA(otherTe), fn, 0); free(fn); } + } else { + /* Skip create on all but the first instance of a shared file */ + if (rpmfsGetAction(otherFs, otherFileNum) != FA_UNKNOWN) { + rpmfsSetAction(fs, i, FA_SKIP); + done = 1; + } } /* Try to get the disk accounting correct even if a conflict. */