Switch to NOATIME for Filer and mirror ctime to atime.

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-03-05 17:00:54 -05:00
parent 8c743bb95a
commit b95ac40e65
2 changed files with 10 additions and 25 deletions

View File

@ -58,7 +58,6 @@ define(function(require) {
XATTR_CREATE: XATTR_CREATE, XATTR_CREATE: XATTR_CREATE,
XATTR_REPLACE: XATTR_REPLACE, XATTR_REPLACE: XATTR_REPLACE,
NOATIME: 'NOATIME',
NOCTIME: 'NOCTIME', NOCTIME: 'NOCTIME',
NOMTIME: 'NOMTIME', NOMTIME: 'NOMTIME',

View File

@ -52,7 +52,6 @@ define(function(require) {
var O_FLAGS = require('src/constants').O_FLAGS; var O_FLAGS = require('src/constants').O_FLAGS;
var XATTR_CREATE = require('src/constants').XATTR_CREATE; var XATTR_CREATE = require('src/constants').XATTR_CREATE;
var XATTR_REPLACE = require('src/constants').XATTR_REPLACE; var XATTR_REPLACE = require('src/constants').XATTR_REPLACE;
var NOATIME = require('src/constants').NOATIME;
var NOMTIME = require('src/constants').NOMTIME; var NOMTIME = require('src/constants').NOMTIME;
var NOCTIME = require('src/constants').NOCTIME; var NOCTIME = require('src/constants').NOCTIME;
@ -105,7 +104,7 @@ define(function(require) {
this.id = id || guid(); this.id = id || guid();
this.mode = mode || MODE_FILE; // node type (file, directory, etc) this.mode = mode || MODE_FILE; // node type (file, directory, etc)
this.size = size || 0; // size (bytes for files, entries for directories) this.size = size || 0; // size (bytes for files, entries for directories)
this.atime = atime || now; // access time this.atime = atime || now; // access time (will mirror ctime after creation)
this.ctime = ctime || now; // creation/change time this.ctime = ctime || now; // creation/change time
this.mtime = mtime || now; // modified time this.mtime = mtime || now; // modified time
this.flags = flags || []; // file flags this.flags = flags || []; // file flags
@ -142,9 +141,6 @@ define(function(require) {
if(_(flags).contains(NOCTIME)) { if(_(flags).contains(NOCTIME)) {
delete times.ctime; delete times.ctime;
} }
if(_(flags).contains(NOATIME)) {
delete times.atime;
}
if(_(flags).contains(NOMTIME)) { if(_(flags).contains(NOMTIME)) {
delete times.mtime; delete times.mtime;
} }
@ -153,9 +149,13 @@ define(function(require) {
var update = false; var update = false;
if(times.ctime) { if(times.ctime) {
node.ctime = times.ctime; node.ctime = times.ctime;
// We don't do atime tracking for perf reasons, but do mirror ctime
node.atime = times.ctime;
update = true; update = true;
} }
if(times.atime) { if(times.atime) {
// The only time we explicitly pass atime is when utimes(), futimes() is called.
// Override ctime mirror here if so
node.atime = times.atime; node.atime = times.atime;
update = true; update = true;
} }
@ -621,9 +621,7 @@ define(function(require) {
callback(error); callback(error);
} else { } else {
fileNode = result; fileNode = result;
update_node_times(context, path, fileNode, { atime: Date.now() }, function(error) { callback(null, fileNode);
callback(error, fileNode);
});
} }
} }
@ -815,14 +813,8 @@ define(function(require) {
callback(error); callback(error);
} else { } else {
fileNode = result; fileNode = result;
update_node_times(context, ofd.path, fileNode, { atime: Date.now() }, function(error) {
if(error) {
callback(error);
} else {
context.get(fileNode.data, handle_file_data); context.get(fileNode.data, handle_file_data);
} }
});
}
} }
context.get(ofd.id, read_file_data); context.get(ofd.id, read_file_data);
@ -836,9 +828,7 @@ define(function(require) {
if(error) { if(error) {
callback(error); callback(error);
} else { } else {
update_node_times(context, path, result, { atime: Date.now() }, function(error) { callback(null, result);
callback(error, result);
});
} }
} }
@ -850,9 +840,7 @@ define(function(require) {
if(error) { if(error) {
callback(error); callback(error);
} else { } else {
update_node_times(context, ofd.path, result, { atime: Date.now() }, function(error) { callback(null, result);
callback(error, result);
});
} }
} }
@ -899,9 +887,7 @@ define(function(require) {
if(error) { if(error) {
callback(error); callback(error);
} else { } else {
update_node_times(context, path, result, { atime: Date.now() }, function(error) { callback(null, result);
callback(error, result);
});
} }
} }
} }