github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/sentry/fs/sync.go (about) 1 // Copyright 2018 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package fs 16 17 // SyncType enumerates ways in which a File can be synced. 18 type SyncType int 19 20 const ( 21 // SyncAll indicates that modified in-memory metadata and data should 22 // be written to backing storage. SyncAll implies SyncBackingStorage. 23 SyncAll SyncType = iota 24 25 // SyncData indicates that along with modified in-memory data, only 26 // metadata needed to access that data needs to be written. 27 // 28 // For example, changes to access time or modification time do not 29 // need to be written because they are not necessary for a data read 30 // to be handled correctly, unlike the file size. 31 // 32 // The aim of SyncData is to reduce disk activity for applications 33 // that do not require all metadata to be synchronized with the disk, 34 // see fdatasync(2). File systems that implement SyncData as SyncAll 35 // do not support this optimization. 36 // 37 // SyncData implies SyncBackingStorage. 38 SyncData 39 40 // SyncBackingStorage indicates that in-flight write operations to 41 // backing storage should be flushed. 42 SyncBackingStorage 43 )