Skip to content

Commit

Permalink
Merge branch 'mocchira-develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yosukehara committed Feb 5, 2017
2 parents 4a9e107 + 218de28 commit 6f4f92b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/leo_gateway/src/leo_nfs_file_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ write_large2any(Key, Start, End, Bin, SrcMetadata) ->
LargeObjectProp, ?DEF_LOBJ_CHUNK_OBJ_LEN),
IndexStart = Start div ChunkedObjLen + 1,
IndexEnd = End div ChunkedObjLen + 1,
LastChunkSize = case IndexStart =:= IndexEnd of
_LastChunkSize = case IndexStart =:= IndexEnd of
true ->
Offset = Start rem ChunkedObjLen,
Size = End - Start + 1,
Expand Down Expand Up @@ -334,9 +334,10 @@ write_large2any(Key, Start, End, Bin, SrcMetadata) ->
end
end,
NumChunks = erlang:max(IndexEnd, SrcMetadata#?METADATA.cnumber),
%% https://github.com/leo-project/leofs/issues/537
%% calc total size
TotalSize = ChunkedObjLen * (NumChunks - 1) + LastChunkSize,
%% https://github.com/leo-project/leofs/issues/596 revealed the below fix was wrong.
%% - https://github.com/leo-project/leofs/issues/537
%% instead must be
TotalSize = erlang:max(End + 1, SrcMetadata#?METADATA.dsize),
large_obj_partial_commit(Key, NumChunks, ChunkedObjLen, TotalSize).

%% @private
Expand Down

0 comments on commit 6f4f92b

Please sign in to comment.