saltstack/salt — pull request #9894 by SaveTheRbtz (2014-01-23 06:37:20+00:00)
Title: master: optimize _return()

Be optimistic about file layout by not checking file existence (which
introduces additional stat(2) calls) but try to create dir and handle
errors in case of failure.

This reduces number of stat calls by 3 per minion per job.

From:
```
stat("/salt/cache/master/jobs/dd/557c790ce8f7f15dbaa679937f130a", {st_mode=S_IFDIR|0755, st_size=86016, ...}) = 0 <0.000011>
stat("/salt/cache/master/jobs/dd/557c790ce8f7f15dbaa679937f130a/nocache", 0x7fff278982a0) = -1 ENOENT (No such file or directory) <0.000010>
stat("/salt/cache/master/jobs/dd/557c790ce8f7f15dbaa679937f130a/host000000.linkedin.com", 0x7fff278982a0) = -1 ENOENT (No such file or directory) <0.000018>
stat("/salt/cache/master/jobs/dd/557c790ce8f7f15dbaa679937f130a", {st_mode=S_IFDIR|0755, st_size=86016, ...}) = 0 <0.000011>
mkdir("/salt/cache/master/jobs/dd/557c790ce8f7f15dbaa679937f130a/host000000.linkedin.com", 0777) = 0 <0.000035>
```

To:
```
stat("/salt/cache/master/jobs/dd/557c790ce8f7f15dbaa679937f130a/nocache", 0x7fff278982a0) = -1 ENOENT (No such file or directory) <0.000010>
mkdir("/salt/cache/master/jobs/dd/557c790ce8f7f15dbaa679937f130a/host000000.linkedin.com", 0777) = 0 <0.000035>
```