@@ -154,18 +154,10 @@ where
154154 Err ( e) => Err ( e. into ( ) ) ,
155155 } ,
156156 UploadState :: Completed => {
157- return Err ( err ! (
158- libc:: EIO ,
159- "upload already completed for key {:?}" ,
160- handle. location. full_key( )
161- ) ) ;
157+ return Err ( err ! ( libc:: EIO , "upload already completed for key {}" , handle. location) ) ;
162158 }
163159 UploadState :: Failed ( e) => {
164- return Err ( err ! (
165- * e,
166- "upload already aborted for key {:?}" ,
167- handle. location. full_key( )
168- ) ) ;
160+ return Err ( err ! ( * e, "upload already aborted for key {}" , handle. location) ) ;
169161 }
170162 } ;
171163
@@ -194,11 +186,7 @@ where
194186 match & self {
195187 UploadState :: Completed => return Ok ( ( ) ) ,
196188 UploadState :: Failed ( e) => {
197- return Err ( err ! (
198- * e,
199- "upload already aborted for key {:?}" ,
200- handle. location. full_key( )
201- ) ) ;
189+ return Err ( err ! ( * e, "upload already aborted for key {}" , handle. location) ) ;
202190 }
203191 _ => { }
204192 } ;
@@ -210,7 +198,7 @@ where
210198 written_bytes,
211199 } => {
212200 let current_offset = request. current_offset ( ) ;
213- match Self :: commit_append ( request, & handle. location . full_key ( ) ) . await {
201+ match Self :: commit_append ( request, & handle. location ) . await {
214202 Ok ( etag) => {
215203 // Restart append request.
216204 let initial_etag = etag. or ( initial_etag) ;
@@ -234,7 +222,7 @@ where
234222 }
235223 }
236224 UploadState :: MPUInProgress { request, .. } => {
237- let result = Self :: complete_upload ( fs, handle. ino , handle. location . full_key ( ) . as_ref ( ) , request) . await ;
225+ let result = Self :: complete_upload ( fs, handle. ino , & handle. location , request) . await ;
238226 if let Err ( e) = & result {
239227 * self = UploadState :: Failed ( e. to_errno ( ) ) ;
240228 }
@@ -260,12 +248,12 @@ where
260248 }
261249 UploadState :: MPUInProgress { request, .. } => {
262250 if request. size ( ) == 0 {
263- debug ! ( key=? handle. location. full_key ( ) , "not completing upload because nothing was written yet" ) ;
251+ debug ! ( key=% handle. location, "not completing upload because nothing was written yet" ) ;
264252 return Ok ( ( ) ) ;
265253 }
266254 if !are_from_same_process ( open_pid, pid) {
267255 debug ! (
268- key=? handle. location. full_key ( ) ,
256+ key=% handle. location,
269257 pid, open_pid, "not completing upload because current PID differs from PID at open" ,
270258 ) ;
271259 return Ok ( ( ) ) ;
@@ -284,9 +272,9 @@ where
284272 let result = match std:: mem:: replace ( self , UploadState :: Completed ) {
285273 UploadState :: AppendInProgress {
286274 request, initial_etag, ..
287- } => Self :: complete_append ( fs, handle. ino , & handle. location . full_key ( ) , request, initial_etag) . await ,
275+ } => Self :: complete_append ( fs, handle. ino , & handle. location , request, initial_etag) . await ,
288276 UploadState :: MPUInProgress { request, .. } => {
289- Self :: complete_upload ( fs, handle. ino , & handle. location . full_key ( ) , request) . await
277+ Self :: complete_upload ( fs, handle. ino , & handle. location , request) . await
290278 }
291279 UploadState :: Failed ( _) | UploadState :: Completed => unreachable ! ( "checked above" ) ,
292280 } ;
@@ -304,7 +292,7 @@ where
304292 self ,
305293 fs : & S3Filesystem < Client > ,
306294 ino : InodeNo ,
307- key : & str ,
295+ key : & S3Location ,
308296 ) -> Result < bool , Error > {
309297 match self {
310298 UploadState :: AppendInProgress {
@@ -324,28 +312,28 @@ where
324312 async fn complete_upload (
325313 fs : & S3Filesystem < Client > ,
326314 ino : InodeNo ,
327- key : & str ,
315+ key : & S3Location ,
328316 upload : UploadRequest < Client > ,
329317 ) -> Result < ( ) , Error > {
330318 let size = upload. size ( ) ;
331319 let ( put_result, etag) = match upload. complete ( ) . await {
332320 Ok ( result) => {
333- debug ! ( etag=?result. etag. as_str( ) , ? key, size, "put succeeded" ) ;
321+ debug ! ( etag=?result. etag. as_str( ) , % key, size, "put succeeded" ) ;
334322 ( Ok ( ( ) ) , Some ( result. etag ) )
335323 }
336324 Err ( e) => ( Err ( err ! ( libc:: EIO , source: e, "put failed" ) ) , None ) ,
337325 } ;
338326 if let Err ( err) = fs. metablock . finish_writing ( ino, etag) . await {
339327 // Log the issue but still return put_result.
340- error ! ( ?err, ? key, "error updating the inode status" ) ;
328+ error ! ( ?err, % key, "error updating the inode status" ) ;
341329 }
342330 put_result
343331 }
344332
345333 async fn complete_append (
346334 fs : & S3Filesystem < Client > ,
347335 ino : InodeNo ,
348- key : & str ,
336+ key : & S3Location ,
349337 upload : AppendUploadRequest < Client > ,
350338 initial_etag : Option < ETag > ,
351339 ) -> Result < ( ) , Error > {
@@ -361,14 +349,14 @@ where
361349 }
362350 }
363351
364- async fn commit_append ( upload : AppendUploadRequest < Client > , key : & str ) -> Result < Option < ETag > , Error > {
352+ async fn commit_append ( upload : AppendUploadRequest < Client > , key : & S3Location ) -> Result < Option < ETag > , Error > {
365353 match upload. complete ( ) . await {
366354 Ok ( Some ( result) ) => {
367- debug ! ( key, "put succeeded" ) ;
355+ debug ! ( % key, "put succeeded" ) ;
368356 Ok ( Some ( result. etag ) )
369357 }
370358 Ok ( None ) => {
371- debug ! ( key, "no put required" ) ;
359+ debug ! ( % key, "no put required" ) ;
372360 Ok ( None )
373361 }
374362 Err ( e) => Err ( err ! ( libc:: EIO , source: e, "put failed" ) ) ,
0 commit comments