Improve block/object write-in.

* Make sure temp file names don't conflict (even the same block);
* When commit, don't write block if the block exists.
[server] Remove trailing slashes in parent_dir for repo ops.