2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-23 13:17:42 +00:00

Merge pull request #131 from fw42/noatime

O_NOATIME on Linux
This commit is contained in:
Alexander Neumann 2015-04-25 10:52:44 +02:00
commit d596712339
4 changed files with 13 additions and 1 deletions

View File

@ -169,7 +169,7 @@ func (arch *Archiver) SaveTreeJSON(item interface{}) (Blob, error) {
// SaveFile stores the content of the file on the backend as a Blob by calling // SaveFile stores the content of the file on the backend as a Blob by calling
// Save for each chunk. // Save for each chunk.
func (arch *Archiver) SaveFile(p *Progress, node *Node) (Blobs, error) { func (arch *Archiver) SaveFile(p *Progress, node *Node) (Blobs, error) {
file, err := os.Open(node.path) file, err := node.OpenForReading()
defer file.Close() defer file.Close()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -11,6 +11,10 @@ import (
"github.com/restic/restic/debug" "github.com/restic/restic/debug"
) )
func (node *Node) OpenForReading() (*os.File, error) {
return os.Open(n.path)
}
func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) { func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
stat, ok := fi.Sys().(*syscall.Stat_t) stat, ok := fi.Sys().(*syscall.Stat_t)
if !ok { if !ok {

View File

@ -11,6 +11,10 @@ import (
"github.com/restic/restic/debug" "github.com/restic/restic/debug"
) )
func (node *Node) OpenForReading() (*os.File, error) {
return os.OpenFile(node.path, os.O_RDONLY|syscall.O_NOATIME, 0)
}
func (node *Node) fill_extra(path string, fi os.FileInfo) error { func (node *Node) fill_extra(path string, fi os.FileInfo) error {
stat, ok := fi.Sys().(*syscall.Stat_t) stat, ok := fi.Sys().(*syscall.Stat_t)
if !ok { if !ok {

View File

@ -2,6 +2,10 @@ package restic
import "os" import "os"
func (node *Node) OpenForReading() (*os.File, error) {
return os.Open(n.path)
}
func (node *Node) fill_extra(path string, fi os.FileInfo) error { func (node *Node) fill_extra(path string, fi os.FileInfo) error {
return nil return nil
} }