From 72f9f1e9c003a9758ced9ad8da9f772367e41652 Mon Sep 17 00:00:00 2001 From: Roberto Ricci Date: Fri, 18 Aug 2023 23:56:40 +0200 Subject: [PATCH] vfs: make sure struct field is aligned for atomic access --- vfs/vfscache/writeback/writeback.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vfs/vfscache/writeback/writeback.go b/vfs/vfscache/writeback/writeback.go index b4ab6d39a..8290dd245 100644 --- a/vfs/vfscache/writeback/writeback.go +++ b/vfs/vfscache/writeback/writeback.go @@ -26,6 +26,9 @@ type Handle uint64 // WriteBack keeps track of the items which need to be written back to the disk at some point type WriteBack struct { + // read and written with atomic, must be 64-bit aligned + id Handle // id of the last writeBackItem created + ctx context.Context mu sync.Mutex items writeBackItems // priority queue of *writeBackItem - writeBackItems are in here while awaiting transfer only @@ -34,9 +37,6 @@ type WriteBack struct { timer *time.Timer // next scheduled time for the uploader expiry time.Time // time the next item expires or IsZero uploads int // number of uploads in progress - - // read and written with atomic - id Handle // id of the last writeBackItem created } // New make a new WriteBack