File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -413,8 +413,8 @@ static ssize_t simplefs_write(struct file *file,
413
413
size_t bytes_to_write =
414
414
min_t (size_t , len , SIMPLEFS_BLOCK_SIZE - pos % SIMPLEFS_BLOCK_SIZE );
415
415
416
- if (copy_from_user (bh_data -> b_data + pos % SIMPLEFS_BLOCK_SIZE , buf ,
417
- bytes_to_write )) {
416
+ if (copy_from_user (bh_data -> b_data + pos % SIMPLEFS_BLOCK_SIZE ,
417
+ buf + bytes_write , bytes_to_write )) {
418
418
brelse (bh_data );
419
419
bytes_write = - EFAULT ;
420
420
break ;
Original file line number Diff line number Diff line change @@ -123,6 +123,18 @@ test_op 'dd if=/dev/zero of=file bs=1M count=12 status=none'
123
123
filesize=$( sudo ls -lR | grep -e " $F_MOD 2" .* file | awk ' {print $5}' )
124
124
test $filesize -le $MAXFILESIZE || echo " Failed, file size over the limit"
125
125
126
+ # Write the file size larger than BLOCK_SIZE
127
+ # test serial to write
128
+ test_op ' printf \"%.0s123456789\" {1..1600} > file.txt'
129
+ count=$( awk ' {count += gsub(/123456789/, "")} END {print count}' " file.txt" )
130
+ echo " test $count "
131
+ test " $count " -eq 1600 || echo " Failed, file size not matching"
132
+ # test block to write
133
+ test_op ' cat file.txt > checkfile.txt'
134
+ count=$( awk ' {count += gsub(/123456789/, "")} END {print count}' " checkfile.txt" )
135
+ echo " test $count "
136
+ test " $count " -eq 1600 || echo " Failed, file size not matching"
137
+
126
138
# test remove symbolic link
127
139
test_op ' ln -s file symlink_fake'
128
140
test_op ' rm -f symlink_fake'
You can’t perform that action at this time.
0 commit comments