Skip to content

Commit 6878a1f

Browse files
meilirensheng2020meilirensheng2020
authored andcommitted
[refact][fuse] Refact set/unset fuse feature flag
1 parent 9223e03 commit 6878a1f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/client/fuse/fuse_op.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ void InitFuseConnInfo(struct fuse_conn_info* conn) {
4848
auto fuse_option = g_vfs->GetFuseOption();
4949
const auto& option = fuse_option.conn_info;
5050

51-
if (conn->capable & FUSE_CAP_SPLICE_MOVE && option.want_splice_move) {
52-
conn->want |= FUSE_CAP_SPLICE_MOVE;
53-
LOG(INFO) << "[enabled] FUSE_CAP_SPLICE_MOVE";
51+
if (option.want_splice_move) {
52+
LOG_IF(INFO, fuse_set_feature_flag(conn, FUSE_CAP_SPLICE_MOVE))
53+
<< "[enabled] FUSE_CAP_SPLICE_MOVE";
5454
}
55-
if (conn->capable & FUSE_CAP_SPLICE_READ && option.want_splice_read) {
56-
conn->want |= FUSE_CAP_SPLICE_READ;
57-
LOG(INFO) << "[enabled] FUSE_CAP_SPLICE_READ";
55+
if (option.want_splice_read) {
56+
LOG_IF(INFO, fuse_set_feature_flag(conn, FUSE_CAP_SPLICE_READ))
57+
<< "[enabled] FUSE_CAP_SPLICE_READ";
5858
}
59-
if (conn->capable & FUSE_CAP_SPLICE_WRITE && option.want_splice_write) {
60-
conn->want |= FUSE_CAP_SPLICE_WRITE;
61-
LOG(INFO) << "[enabled] FUSE_CAP_SPLICE_WRITE";
59+
if (option.want_splice_write) {
60+
LOG_IF(INFO, fuse_set_feature_flag(conn, FUSE_CAP_SPLICE_WRITE))
61+
<< "[enabled] FUSE_CAP_SPLICE_WRITE";
6262
}
63-
if (conn->capable & FUSE_CAP_AUTO_INVAL_DATA &&
63+
if (fuse_get_feature_flag(conn, FUSE_CAP_AUTO_INVAL_DATA) &&
6464
!option.want_auto_inval_data) {
6565
fuse_unset_feature_flag(conn, FUSE_CAP_AUTO_INVAL_DATA);
6666
LOG(INFO) << "[disabled] FUSE_CAP_AUTO_INVAL_DATA";

0 commit comments

Comments
 (0)