|
19 | 19 | * File Created: Thursday, 6th September 2018 10:49:53 am
|
20 | 20 | * Author: yangyaokai
|
21 | 21 | */
|
| 22 | +#include <errno.h> |
22 | 23 | #include <fcntl.h>
|
23 | 24 | #include <algorithm>
|
24 | 25 | #include <memory>
|
@@ -207,7 +208,8 @@ CSErrorCode CSChunkFile::Open(bool createFile) {
|
207 | 208 | if (rc != 0 && rc != -EEXIST) {
|
208 | 209 | LOG(ERROR) << "Error occured when create file."
|
209 | 210 | << " filepath = " << chunkFilePath;
|
210 |
| - return CSErrorCode::InternalError; |
| 211 | + return rc == -ENOSPC ? CSErrorCode::NoSpaceError : |
| 212 | + CSErrorCode::InternalError; |
211 | 213 | }
|
212 | 214 | }
|
213 | 215 | int rc = -1;
|
@@ -400,7 +402,8 @@ CSErrorCode CSChunkFile::Write(SequenceNum sn,
|
400 | 402 | << "ChunkID: " << chunkId_
|
401 | 403 | << ",request sn: " << sn
|
402 | 404 | << ",chunk sn: " << metaPage_.sn;
|
403 |
| - return CSErrorCode::InternalError; |
| 405 | + return rc == -ENOSPC ? CSErrorCode::NoSpaceError : |
| 406 | + CSErrorCode::InternalError; |
404 | 407 | }
|
405 | 408 | // If it is a clone chunk, the bitmap will be updated
|
406 | 409 | CSErrorCode errorCode = flush();
|
@@ -478,7 +481,8 @@ CSErrorCode CSChunkFile::Paste(const char * buf, off_t offset, size_t length) {
|
478 | 481 | << "ChunkID: " << chunkId_
|
479 | 482 | << ", offset: " << offset
|
480 | 483 | << ", length: " << length;
|
481 |
| - return CSErrorCode::InternalError; |
| 484 | + return rc == -ENOSPC ? CSErrorCode::NoSpaceError : |
| 485 | + CSErrorCode::InternalError; |
482 | 486 | }
|
483 | 487 | }
|
484 | 488 |
|
|
0 commit comments