|
56 | 56 | */ |
57 | 57 |
|
58 | 58 | #include "libltfs/ltfs.h" |
| 59 | +#include "libltfs/ltfs_locking_old.h" |
59 | 60 | #include "libltfs/tape.h" |
60 | 61 | #include "libltfs/ltfs_fsops_raw.h" |
61 | 62 | #include "libltfs/index_criteria.h" |
@@ -252,7 +253,6 @@ void _unified_unset_write_ip(struct dentry_priv *dpr, struct unified_data *priv) |
252 | 253 | void _unified_handle_write_error(ssize_t write_ret, struct write_request *req, |
253 | 254 | struct dentry_priv *dpr, struct unified_data *priv); |
254 | 255 | int _unified_get_write_error(struct dentry_priv *dpr); |
255 | | -int _unified_write_index_after_perm(int write_ret, struct unified_data *priv); |
256 | 256 |
|
257 | 257 | /** |
258 | 258 | * Initialize an instance of the unified scheduler. |
@@ -1189,9 +1189,6 @@ void _unified_process_index_queue(struct unified_data *priv) |
1189 | 1189 | if (ret < 0) { |
1190 | 1190 | /* Index partition writer: failed to write data to the tape (%d) */ |
1191 | 1191 | ltfsmsg(LTFS_WARN, 13013W, (int)ret); |
1192 | | - if (IS_WRITE_PERM(-ret)) { |
1193 | | - ret = tape_set_cart_volume_lock_status(priv->vol, PWE_MAM_IP); |
1194 | | - } |
1195 | 1192 | _unified_handle_write_error(ret, req, dentry_priv, priv); |
1196 | 1193 | break; |
1197 | 1194 | } else { |
@@ -1283,7 +1280,6 @@ void _unified_process_data_queue(enum request_state queue, struct unified_data * |
1283 | 1280 | if (ret < 0) { |
1284 | 1281 | /* Data partition writer: failed to write data to the tape (%d) */ |
1285 | 1282 | ltfsmsg(LTFS_WARN, 13014W, (int)ret); |
1286 | | - (void)_unified_write_index_after_perm(ret, priv); |
1287 | 1283 | _unified_handle_write_error(ret, req, dentry_priv, priv); |
1288 | 1284 | break; |
1289 | 1285 | } else { |
@@ -1314,7 +1310,9 @@ void _unified_process_data_queue(enum request_state queue, struct unified_data * |
1314 | 1310 | if (ret < 0) { |
1315 | 1311 | /* Data partition writer: failed to write data to the tape (%d) */ |
1316 | 1312 | ltfsmsg(LTFS_WARN, 13014W, (int)ret); |
1317 | | - (void)_unified_write_index_after_perm(ret, priv); |
| 1313 | + |
| 1314 | + // Note: Do we need to handle these errors? |
| 1315 | + // _unified_handle_write_error(ret, req, dentry_priv, priv); |
1318 | 1316 | break; |
1319 | 1317 | } else { |
1320 | 1318 | TAILQ_REMOVE(&local_req_list, req, list); |
@@ -1961,7 +1959,6 @@ int _unified_flush_unlocked(struct dentry *d, struct unified_data *priv) |
1961 | 1959 | ret = ltfs_fsraw_write(d, req_cache, req->count, req->offset, dp_id, false, priv->vol); |
1962 | 1960 | if (ret < 0) { |
1963 | 1961 | ltfsmsg(LTFS_ERR, 13019E, (int)ret); |
1964 | | - (void)_unified_write_index_after_perm(ret, priv); |
1965 | 1962 | _unified_handle_write_error(ret, req, dpr, priv); |
1966 | 1963 | break; |
1967 | 1964 | } else if (dpr->write_ip) { |
@@ -2246,56 +2243,6 @@ int _unified_get_write_error(struct dentry_priv *dpr) |
2246 | 2243 | return ret; |
2247 | 2244 | } |
2248 | 2245 |
|
2249 | | -int _unified_write_index_after_perm(int write_ret, struct unified_data *priv) |
2250 | | -{ |
2251 | | - int ret = 0; |
2252 | | - struct tc_position err_pos; |
2253 | | - uint64_t last_index_pos = UINT64_MAX; |
2254 | | - unsigned long blocksize; |
2255 | | - |
2256 | | - if (!IS_WRITE_PERM(-write_ret)) { |
2257 | | - /* Nothing to do for non-medium error */ |
2258 | | - return ret; |
2259 | | - } |
2260 | | - |
2261 | | - ltfsmsg(LTFS_INFO, 13024I, write_ret); |
2262 | | - ret = tape_set_cart_volume_lock_status(priv->vol, PWE_MAM_DP); |
2263 | | - if (ret < 0) |
2264 | | - ltfsmsg(LTFS_ERR, 13026E, "update MAM", ret); |
2265 | | - |
2266 | | - blocksize = ltfs_get_blocksize(priv->vol); |
2267 | | - |
2268 | | - ret = tape_get_first_untransfered_position(priv->vol->device, &err_pos); |
2269 | | - if (ret < 0) { |
2270 | | - ltfsmsg(LTFS_ERR, 13026E, "get error pos", ret); |
2271 | | - return ret; |
2272 | | - } |
2273 | | - |
2274 | | - /* Check the err_pos is larger than the last index position of the partition */ |
2275 | | - if (err_pos.partition == ltfs_part_id2num(priv->vol->label->partid_ip, priv->vol)) { |
2276 | | - last_index_pos = priv->vol->ip_coh.set_id; |
2277 | | - } else { |
2278 | | - last_index_pos = priv->vol->dp_coh.set_id; |
2279 | | - } |
2280 | | - |
2281 | | - if (last_index_pos > err_pos.block) { |
2282 | | - ltfsmsg(LTFS_INFO, 13027I, (int)err_pos.partition, |
2283 | | - (unsigned long long)err_pos.block, (unsigned long long)last_index_pos); |
2284 | | - err_pos.block = last_index_pos + 1; |
2285 | | - } |
2286 | | - |
2287 | | - ltfsmsg(LTFS_INFO, 13025I, (int)err_pos.partition, (unsigned long long)err_pos.block, blocksize); |
2288 | | - ret = ltfs_fsraw_cleanup_extent(priv->vol->index->root, err_pos, blocksize, priv->vol); |
2289 | | - if (ret < 0) { |
2290 | | - ltfsmsg(LTFS_ERR, 13026E, "extent cleanup", ret); |
2291 | | - return ret; |
2292 | | - } |
2293 | | - |
2294 | | - ret = ltfs_write_index(ltfs_ip_id(priv->vol), SYNC_WRITE_PERM, priv->vol); |
2295 | | - |
2296 | | - return ret; |
2297 | | -} |
2298 | | - |
2299 | 2246 | /** |
2300 | 2247 | * Enable profiler function |
2301 | 2248 | * @param work_dir work directory to store profiler data |
|
0 commit comments