MCPcopy Create free account
hub / github.com/ceph/ceph / read_dirs

Method read_dirs

src/client/SyntheticClient.cc:1788–1827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1786 return 0;
1787}
1788int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int depth)
1789{
1790 if (time_to_stop()) return 0;
1791
1792 struct stat st;
1793
1794 // children
1795 char d[500];
1796 dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
1797
1798 list<string> contents;
1799 UserPerm perms = client->pick_my_perms();
1800 utime_t s = ceph_clock_now();
1801 int r = client->getdir(basedir, contents, perms);
1802 utime_t e = ceph_clock_now();
1803 e -= s;
1804 if (r < 0) {
1805 dout(0) << "getdir couldn't readdir " << basedir << ", stopping" << dendl;
1806 return -1;
1807 }
1808
1809 for (int i=0; i<files; i++) {
1810 snprintf(d, sizeof(d), "%s/file.%d", basedir, i);
1811 utime_t s = ceph_clock_now();
1812 if (client->lstat(d, &st, perms) < 0) {
1813 dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl;
1814 return -1;
1815 }
1816 utime_t e = ceph_clock_now();
1817 e -= s;
1818 }
1819
1820 if (depth > 0)
1821 for (int i=0; i<dirs; i++) {
1822 snprintf(d, sizeof(d), "%s/dir.%d", basedir, i);
1823 if (read_dirs(d, dirs, files, depth-1) < 0) return -1;
1824 }
1825
1826 return 0;
1827}
1828
1829
1830int SyntheticClient::make_files(int num, int count, int priv, bool more)

Callers

nothing calls this directly

Calls 4

ceph_clock_nowFunction · 0.85
pick_my_permsMethod · 0.80
getdirMethod · 0.80
lstatMethod · 0.45

Tested by

no test coverage detected